Find Maximum Distance [ Google-Amazon ]

Problem: An array of integers will be given, find the maximum distance of indexes of  [j – i]  subjected to the constraint of A[i] <= A[j].

A : [4 6 5 3]; Output : 2; For the pair (4, 5).

Link

 

 

Comments are closed.