Amazon Interview Question

Find next greater element for each of the elements in the array.