일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 주정부이민
- 조지아텍
- 머신러닝
- omscs
- machine learning
- EOI
- 컴퓨터과학과
- 코딩테스트
- 선형대수
- Deep learning
- Plotting
- 위니펙
- C++
- 캐나다 영주권
- 프로그래머스
- 알고리즘
- cpp
- 딥러닝
- LV1
- LAA
- zeros
- mpnp
- 매트랩
- 방통대
- 온라인석사
- 개발자
- 방송통신대학교
- leetcode
Archives
- Today
- Total
Byte by Byte
1557. Minimum Number of Vertices to Reach All Nodes.cpp 본문
class Solution {
public:
vector<int> findSmallestSetOfVertices(int n, vector<vector<int>>& edges) {
vector<int>res;
set<int>s;
for(int i =0; i<edges.size();i++){
s.insert(edges[i][1]);
}
for(int i =0; i<n;i++){
if(s.find(i)==s.end()){
res.push_back(i);
}
}
return res;
}
};
'개발 로그 > 알고리즘' 카테고리의 다른 글
950. Reveal Cards In Increasing Order.cpp (0) | 2021.10.07 |
---|---|
921. Minimum Add to Make Parentheses Valid.cpp (0) | 2021.10.07 |
1941. Check if All Characters Have Equal Number of Occurrences.cpp (0) | 2021.10.07 |
1381. Design a Stack With Increment Operation.cpp (0) | 2021.10.07 |
1812. Determine Color of a Chessboard Square.cpp (0) | 2021.10.07 |