Flipkart Interview Question

find the next greatest element in an array