an array consists of height of n bars.

there is robot which picks all the bars that are taller than the one to its immediate left in each step.

the robot does this step until no bars can be picked.

find the number steps so that no bars can be picked after that.

sample testcase:

5 1 4 2

after 1st step: 5 1 2

after 2nd step: 5 1

after 2nd step no more bars can be picked

answer: 2

what is the efficient approach to solve this question? @carre @ssjgz @l_returns @mgch @chenreddy @dardev @ssrivastava990