Amazon interview question

Next Greater Element (stack)