0 ms, faster than 100.00% of Java online submissions o(n) Solution
Runtime: 0 ms, faster than 100.00% of Java online submissions for Maximum Population Year.\nMemory Usage: 36.6 MB, less than 96.04% of Java online submissions f
**Runtime: 0 ms, faster than 100.00% of Java online submissions for Maximum Population Year.\nMemory Usage: 36.6 MB, less than 96.04% of Java online submissions for Maximum Population Year.**\nhere is the expalnation :\nhere the array is given of [[1993,1999],[2000,2010]]\nso what i do is according to this \n1 <= logs.length <= 100\n1950 <= birthi < deathi <= 2050\nlogs[0] and log[1] is bitween 1950 t0 2050 that mean 2050-1950 =100;\nso i ceated year array of 101 size;\nthan \nlog[0]=1993\nso year[1993-1950]=43 so year[43]=1;\nlog[1]=1999\nyear[1999-1950]=49 so year[49]= -1;\nfor second array \nlog[0]=2000\nyear[2000-1950]=50 so year[50]=1;\nlog[1]=2010\nyear[2010-1950]=60 year[60]=-1;\nnow i took maxnum=year[0] and maxYear=1950\nbecause posibility is the maximmum year can not after tha 1950 and maxnum can\'t less than 0\nthan start from 1 and add previsous value and check if max \nand i started from 1 and go till 100 and add 1950 so i get that exget year\n```\npublic int maximumPopulation(int[][] logs) {\n        int[] year=new int[101];\n        for(int[] log:logs){\n            year[log[0]-1950]++;\n            year[log[1]-1950]--;\n        }\n        int maxNum=year[0],maxYear=1950;\n        for(int i=1;i<year.length;i++){\n            year[i] += year[i-1];\n            if(year[i]>maxNum){\n                maxNum=year[i];\n                maxYear=i+1950;\n            }\n        }\n        return maxYear;\n    }\n```
['Java']