2 JAVA Solutions with explanation
i) Naive approach using an array for taking frequency of every year\'s population\n\npublic int maximumPopulation(int[][] logs) {\n        int res[] = new int[1
i) Naive approach using an array for taking frequency of every year\'s population\n```\npublic int maximumPopulation(int[][] logs) {\n        int res[] = new int[101];\n        int max = 0;\n        int year = -1;\n        for(int i=0; i<logs.length; i++){\n            for(int j=logs[i][0]; j<logs[i][1]; j++){\n                res[j-1950]++;\n            }\n        }\n        \n        for(int i=0; i<101; i++){\n            if(res[i] > max){\n                    max = res[i];\n                    year = i+1950;\n                }\n        }\n        return year;\n    }\n```\n\nii) taking prefix sum\n\n```\npublic int maximumPopulation(int[][] logs) {\n        int res[] = new int[101];\n        \n        for(int[] log : logs){\n            res[log[0]-1950]++;\n            res[log[1]-1950]--;\n        }\n        \n        int max = res[0];\n        int year = 1950;\n        \n        for(int i=1; i<101; i++){\n            res[i] += res[i-1];\n            if(res[i] > max){\n                    max = res[i];\n                    year = i+1950;\n            }\n        }\n        return year;\n    }\n``` \nplease upvote.
['Prefix Sum', 'Java']