C++ solution || Beginner-friendly approach || Line-sweep
Intuition\n Describe your first thoughts on how to solve this problem. \nWe first put +1 and -1 for birth and death year of a person. We then traverse the array
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe first put +1 and -1 for birth and death year of a person. We then traverse the array and sum the values to find the year with maximum population.\n\n# Code\n```\nclass Solution {\npublic:\n    int maximumPopulation(vector<vector<int>>& logs) {\n    int pop[2051] = {}, res = 0;\n    for (auto &l : logs) {\n        ++pop[l[0]];\n        --pop[l[1]];\n    }\n    for (auto i = 1950; i < 2050; ++i) {\n        pop[i] += pop[i - 1];\n        res = pop[i] > pop[res] ? i : res;\n    }\n    return res;\n}\n};\n```
['C++']