Simple java code 0 ms beats 100 %
\n# Complexity\n- \n\n# Code\n\nclass Solution {\n    int count=0;\n    public void result(int[][] matrix,int i,int max){\n        if(i==matrix.length){\n      
\n# Complexity\n- \n![image.png](https://assets.leetcode.com/users/images/e12a1c93-b317-4640-b6b3-528ba18eab10_1705321767.5801973.png)\n# Code\n```\nclass Solution {\n    int count=0;\n    public void result(int[][] matrix,int i,int max){\n        if(i==matrix.length){\n            return ;\n        }\n        int temp= Math.min(matrix[i][0],matrix[i][1]);\n        if(temp>max){\n            count=1;\n            max=temp;\n        }\n        else if(max==temp){\n            count++;\n        }\n        result(matrix,i+1,max);         \n    }\n    public int countGoodRectangles(int[][] rectangles) {\n        result(rectangles,0,Integer.MIN_VALUE);\n        return count;\n    }\n}\n```
['Java']