Java Sol | 0ms | 100% faster | with explanation
\nclass Solution {\n    public int maximumPopulation(int[][] logs) {\n\n        int[] arr = new int[101]; \n        //1950-2050 +1\n        // brute force -> O(
```\nclass Solution {\n    public int maximumPopulation(int[][] logs) {\n\n        int[] arr = new int[101]; \n        //1950-2050 +1\n        // brute force -> O(n^2)\n        // optimized -> O(n)\n        \n        int max=Integer.MIN_VALUE;\n        int count=0, year=0;\n        \n        for(int[] log:logs) {\n            arr[log[0]-1950]++;\n            arr[log[1]-1950]--;\n        }\n        \n        for(int i=1950; i<=2050; i++) {\n            // IMP -> count will be the running sum of the array \n            \n            // example - [[1993,1999],[2000,2010]]\n            // arr = [0,0......,1,0,0,..0,-1,...]\n            // arr[1993 -1950] will have value 1 \n            // so count = 1 from 1993 to 1949 \n            // count =0 at 1950 \n            // so the only instance max<count is when i=1993\n            // next time max=1 so for [2000,2010] year will not be updated\n            \n            count += arr[i-1950];\n            \n            year = max < count ? i : year;\n            max=Math.max(max,count);\n        }\n        \n        return year;\n    \n    }\n}\n```
['Array', 'Java']