Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

During the assembly, a teacher lines up N students in a line in front of her. She can see the first student and all the

During the assembly, a teacher lines up N students in a line in front of her. She can see the first student and all the students taller than the students before them ( i.e a teacher can see the student i if hi>hj> for all j ,ji ). How many students will the teacher be able to see? WRITE A PROGRAM IN C LANGUAGE.

input Format

The first line will have 1 integer N.

The second line will contain the heights of the students which would be integers in the order of them getting farther from the teacher. (will be separated by a space)

Output Format

Output a single integer which is the amount of students the teacher will be able to see.

Constraints

1N10^5

2hi10^9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago