✅C++ || Brute force
\n\nn==log.size()\nT->O((j-i) * n ) && S->O(1)\n\n\tclass Solution {\n\tpublic:\n\t\tint maximumPopulation(vector>& logs) {\n\t\t\tint i=INT_MAX,j=INT_MIN;\n\t\
![image](https://assets.leetcode.com/users/images/ee5e9590-9120-4854-b46c-c165ad587f4f_1657309940.7559059.png)\n\n**n==log.size()\nT->O((j-i) * n ) && S->O(1)**\n\n\tclass Solution {\n\tpublic:\n\t\tint maximumPopulation(vector<vector<int>>& logs) {\n\t\t\tint i=INT_MAX,j=INT_MIN;\n\t\t\tfor(int k=0;k<logs.size();k++){\n\t\t\t\ti=min(logs[k][0],i);\n\t\t\t\tj=max(logs[k][1],j);\n\t\t\t}\n\t\t\tint maxpop=INT_MIN,count;\n\t\t\tint a=i,b=j;\n\t\t\twhile(i<j){\n\t\t\t\tcount=0;\n\t\t\t\tfor(int k=0;k<logs.size();k++){\n\t\t\t\t\tif(logs[k][0]<=i && i<logs[k][1])count++;\n\t\t\t\t}\n\t\t\t\tmaxpop=max(maxpop,count);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\twhile(a<b){\n\t\t\t\tcount=0;\n\t\t\t\tfor(int k=0;k<logs.size();k++){\n\t\t\t\t\tif(logs[k][0]<=a && a<logs[k][1])count++;\n\t\t\t\t}\n\t\t\t\tif(maxpop==count)return a;\n\t\t\t\ta++;\n\t\t\t}\n\t\t\treturn -1;\n\t\t}\n\t};
['C', 'C++']