JAVA 2ms 99.53% less memory easy solution  O(1) space
\nPlease Upvote if you find this helpful\n\nclass Solution {\n    public int maximumPopulation(int[][] logs) {\n        int recentMaxPopulation = 0;\n        in
![image](https://assets.leetcode.com/users/images/75f2eb47-4ff2-43fe-a417-31027a46a801_1648994486.3089933.png)\n***Please Upvote if you find this helpful***\n```\nclass Solution {\n    public int maximumPopulation(int[][] logs) {\n        int recentMaxPopulation = 0;\n        int alivePerson = 0;\n        int previousYear = 0;\n        for (int i = 0; i < logs.length; i++) {\n            int[] log = logs[i];\n            for (int j = 0; j < logs.length; j++) {\n                int[] ints = logs[j];\n                if (logs[i][0] >= logs[j][0] && logs[i][0] < logs[j][1]) alivePerson++;\n            }\n            if (alivePerson > previousYear || (alivePerson == previousYear && log[0] < recentMaxPopulation)) {\n                recentMaxPopulation = log[0];\n                previousYear = alivePerson;\n            }\n            alivePerson = 0;\n        }\n        return recentMaxPopulation;\n    }\n}\n```\n***please Upvote if you find this helpful***\n
['Array', 'Java']