Walmart FTE question
Anonymous User
2198

Given an array of integers. Find maximum absolute difference for an element arr[i], such that the difference between the number of integers greater than arr[i] in the range 0 to i-1 and the number of integers lesser than arr[i] in the range i+1 to n is maximum.
no brute force approach
e.g.
input: 1,4,2,7
output: 1

Input : 2 6 4 1 8 5 7 3      
Output: 4 (maximum difference is for6’ which is 4)
Comments (4)