일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 딥러닝
- machine learning
- 머신러닝
- 주정부이민
- 알고리즘
- leetcode
- zeros
- 온라인석사
- 방송통신대학교
- 조지아텍
- EOI
- mpnp
- Plotting
- 캐나다 영주권
- 프로그래머스
- C++
- 코딩테스트
- LAA
- 방통대
- 선형대수
- cpp
- LV1
- 개발자
- Deep learning
- 마니토바
- MATLAB
- 매트랩
- omscs
- 기본
- 컴퓨터과학과
Archives
- Today
- Total
Krononberg
1854. Maximum Population Year.cpp 본문
class Solution {
public:
int maximumPopulation(vector<vector<int>>& logs) {
int alive[101]={0,};
for(auto log : logs){
for(int i = log[0]-1950; i<log[1]-1950;i++) alive[i]++;
}
int maxn = 0;
int maxidx =0;
for(int i = 0; i<101; i++){
//cout<< alive[i] << " ";
//if(i%10==0) cout<<endl;
if (maxn < alive[i]){
maxn = alive[i];
maxidx = i + 1950;
}
}
return maxidx;
}
};
'개발 로그 > 알고리즘' 카테고리의 다른 글
python - string Module ) from collections import Counter (0) | 2022.05.11 |
---|---|
442. Find All Duplicates in an Array.cpp (0) | 2022.01.24 |
49. Group Anagrams.cpp (0) | 2021.12.16 |
1078. Occurrences After Bigram.cpp (0) | 2021.12.15 |
1598. Crawler Log Folder.cpp (0) | 2021.12.15 |