Maximize Greatness Of An Array Leetcode Question