public class Solution { public int[] nextGreaterElement(int[] findNums, int[] nums) { Stack stack = new Stack<>(); HashMap map = new HashMap<>(); for(int num : nums) { while(!stack.isEmpty() && stack.peek() < num) map.put(stack.pop(),num); stack.push(num); } for(int i=0; i