Anonymous
BAN USER- 0of 0 votes
AnswersLakshmi is a primary school teacher. She wants to give some laddus to the children in her class. All the students sit in a line and each of them has a rating score according to his or her usual performance. Lakshmi wants to give at least 1 laddu for each child. Children get jealous of their immediate neighbors, so if two children sit next to each other then the one with the higher rating must get more laddus. Lakshmi wants to save money, so she wants to minimize the total number of laddus.
- Anonymous in United States
Tip: Please understand the question clearly and pay good attention to below provide - sample input and output - completely in order to arrive at correct solution.
Input
The first line of the input is an integer N, the number of children in Lakshmi's class. Each of the following N lines contains an integer indicates the rating of each child.
Ouput
Output a single line containing the minimum number of laddus Lakshmi must give.
Explanation
Sample Input
3
1
2
2
Sample Ouput
4
Explanation
The number of laddus Lakshmi must give are 1, 2 and 1.| Report Duplicate | Flag | PURGE
Java