Super EASY Java O(n) time O(1) space 5-line solution

  • 0
        public int maxCount(int m, int n, int[][] ops) {
            int minX = n;
            int minY = m;
            for (int[] a : ops) {
                minY = Math.min(minY, a[0]);
                minX = Math.min(minX, a[1]);
            return minX * minY;

Log in to reply

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