Java | O(n) | Easy solution ✅
Approach\n Easy Approach\n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity:  O(n)\n\n# Code\n\nclass Solution {\n    public int countGoodRectangles
# Approach\n Easy Approach\n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity:  O(n)\n\n# Code\n```\nclass Solution {\n    public int countGoodRectangles(int[][] rectangles) {\n        int[] temp = new int[rectangles.length];\n        int max = Integer.MIN_VALUE;\n        int res = 0;\n        for(int i=0; i<rectangles.length; i++){\n            temp[i] = Math.min(rectangles[i][0],rectangles[i][1]);\n        }\n        for(int i=0; i<temp.length; i++){\n            max = Math.max(temp[i],max);\n        }\n        for(int i=0; i<temp.length; i++){\n            if(temp[i]==max){\n                res++;\n            }\n        }\n        return res;\n    }\n}\n```
['Java']