JAVA | Range Addition | 100% faster
Objective  -  You have to calculate for every year, how many people are alive.\nAlgorithm\n- Make an array of size max_year possible according to constraints an
**Objective**  -  You have to calculate for every year, how many people are alive.\n***Algorithm***\n- Make an array of size max_year possible according to constraints and traverse the logs.\n- Increment all the years in the year array which lie in the born -> die range for every entry in the log by 1.\n- Find the year with the maximum number of people alive and return it.\n\nDo upvote the solution if you like it and comment optimizations if any.\n\n```\npublic int maximumPopulation(int[][] logs) {\n        int year[] = new int[2051], i, max = Integer.MIN_VALUE, j;\n        for(i=0;i<logs.length;i++)\n            for(j=logs[i][0];j<logs[i][1];j++)\n                year[j]++;\n        j = 1949;\n        for(i=1950;i<=2050;i++)\n            if(year[i] > max) {\n                j = i;\n                max = year[i];\n            }\n        return j;\n}\n```\nThank You!
['Java']