class Solution { // Function to find the next greater element for each element of the array. public ArrayList nextLargerElement(int[] arr) { // code here ArrayList al=new ArrayList<>(); for(int i=0;i