Given an Array A, partition it into two (contiguous) subarrays left and right such that
Eg-1:
Input=[5,0,4,6,3,8] , Output: 5Since if you partition @ 3 (index=4) all elements in left will be less than right and cannot shrink left further satisfying the three conditions
Eg-2:
Input=[5,0,4,6,8] , Output: 3left Partition @ 4 (Index=2) which is smallest left satisfying the above conditions.
I couldn't come up with a solution in a 45 m in interview for this problem. Thinking totally bombed it... :(