Rust - Sweep Line
Solution - github\n\nProblem List related to #SweepLine - github\n\nProblem List related to #Greedy - github\n\n\n/// @author: Leon\n/// https://leetcode.com/pr
Solution - [github](https://github.com/An7One/leetcode-solutions-rust-an7one/tree/main/src/leetcode/lvl2/lc1854)\n\nProblem List related to #SweepLine - [github](https://github.com/An7One/leetcode-problems-by-tag-an7one/blob/main/txt/by_algorithm/greedy/by_topic/sweep_line.txt)\n\nProblem List related to #Greedy - [github](https://github.com/An7One/leetcode-problems-by-tag-an7one/tree/main/txt/by_algorithm/greedy)\n\n```\n/// @author: Leon\n/// https://leetcode.com/problems/maximum-population-year/\n/// Time Complexity:    O(`RANGE`)\n/// Space Complexity:   O(`RANGE`) ~ O(1)\n/// Reference:\n/// https://leetcode.com/problems/maximum-population-year/discuss/1198838/Java-Array-Solution\nimpl Solution {\n    pub fn maximum_population(logs: Vec<Vec<i32>>) -> i32 {\n        const RANGE: usize = 2050 - 1950 + 1;\n        const YEAR_BASE: usize = 1950;\n        let timeline: Vec<i32> = {\n            let mut timeline = vec![0; RANGE];\n            for log in logs{\n                let start: usize = log[0] as usize;\n                let end: usize = log[1] as usize;\n                for i in start..end {\n                    timeline[i - YEAR_BASE] += 1;\n                }\n            }\n            timeline\n        };\n        let mut max: i32 = 0;\n        let mut max_year: usize = 0;\n        for (idx_year, population) in timeline.into_iter().enumerate() {\n            if population > max {\n                max = population;\n                max_year = idx_year + YEAR_BASE;\n            }\n        }\n        max_year as i32\n    }\n}\n```
['Greedy', 'Rust']