Moving right (Contest)
Moving right (Contest) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Moving right (Contest) easy Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement :
Given an array of heights of N buildings in a row. You can start from any building and jump to the adjacent right building till the height of the building to the right is less than or equal to the height of your current building. Find the maximum number of jumps you can make. Input The first line of input contains a single integer N. The second line of input contains N integers, denoting the array height.
Constraints: 1 <= N <= 105 1 <= height[i] <= 109 Output Print the maximum number of jumps you can make. Example Sample Input:- 5 5 4 1 2 1
Sample Output:- 2
Explanation: We start from building with height 5 then jump right to building with height 4 then again to building with height 1 making a total of 2 jumps.
link: