There are n number of students in a class. Each student is rated with some performance
score. The teacher wants to distribute candies to the students such that each students
gets at least one candy. If the two students sitting next to each other then one with
higher ratings must get more candies. What is the minimum number of candy required
to distribute in the class.
Constraints:
1 <= n <= 10^5
1 <= ratings <= 10^5
Input and Output format:
First line of the input contains n i.e. number of students. Followed by n numbers representing rating of respective student. Output the minimum number of candies required.
All the students must get at least 1 candy so total number candies is 3. But since the 2 nd student has higher rating i.e. 2 that the first one i.e. 1 hence 2 nd student must be getting 2 candies, hence total number of candies is 4.