Easy understand


  • 0
    Q
        int i = 0;
        int j = height.length - 1;
        int max = Integer.MIN_VALUE;
        while (i < j)
        {
            int temp = Math.min(height[j] , height[i])*(j-i);
            if (max < temp)
                max = temp;
            if (height[j] < height[i])
                j--;
            else 
                i++;
                
        }
        return max;

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.