资讯动态

leetcode 耗时100 1854. Maximum Population Year

发布时间:2026/9/28 18:05:50 来源:尧图企业网站定制
Problem: 1854. 人口最多的年份耗时100前缀和差和Codeclass Solution { public: vectorint tr; int maximumPopulation(vectorvectorint logs) { tr.assign(2051, 0); for(vectorint l : logs) { tr[l[0]]; tr[l[1]]--; } int mx 0, sum 0, year; for(int i 1950; i 2051; i) { sum tr[i]; if(mx sum) { mx sum; year i; } } return year; } };

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价 →
↑