Directi Interview Question
- 0of 0 votes
There's an array of length N. For every element of array, say 'X' , find a element 'Y' in the same array such that,
1. Value of Y<Value of X
2. Position of Y<Position of X
3. Position of Y should be as large as possible.
Note: If there's no such element 'Y' fro particular 'X' return NULL. Also give algorithm with time complexity less than O(N*N).