Javascript line sweep algo
Intuitionline sweep algorithmApproachmake an array line of 2052 (constraint) length. sweep through it and remember the end year is not inclusive. record the max
# Intuition
line sweep algorithm

# Approach
make an array line of 2052 (constraint) length. sweep through it and remember the end year is not inclusive. record the maximum.

# Complexity
- Time complexity:
O(n)

- Space complexity:
O(n)

# Code
```javascript []
/**
 * @param {number[][]} logs
 * @return {number}
 */
var maximumPopulation = function(logs) {
    let line=new Array(2052).fill(0);
    for(let i=0;i<logs.length;i++){
        line[logs[i][0]]++;
        line[logs[i][1]]--;
    }
    for(let i=1;i<line.length;i++){
        line[i]+=line[i-1];
    }
    let max=0;
    let fin=0;
    for(let i=0;i<line.length;i++){
        if(line[i]>max){
            max=line[i];
            fin=i;
        }
    }
    return fin;
};
```
['Line Sweep', 'JavaScript']