일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 알고리즘
- 기본
- MATLAB
- 방통대
- cpp
- LAA
- Plotting
- zeros
- 프로그래머스
- 선형대수
- 주정부이민
- 코딩테스트
- 온라인석사
- omscs
- C++
- 매트랩
- machine learning
- 머신러닝
- 딥러닝
- 개발자
- mpnp
- Deep learning
- 캐나다 영주권
- 컴퓨터과학과
- 조지아텍
- EOI
- leetcode
- 방송통신대학교
- LV1
- 위니펙
Archives
- Today
- Total
Byte by Byte
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 |