할 일 목록1 [프로그래머스][C++] 할 일 목록 1 #include #include using namespace std; vector solution(vector todo_list, vector finished) { vector answer; for(int i = 0; i < todo_list.size(); i++) { if(!finished[i]) { // 일을 못 마침 answer.push_back(todo_list[i]); } } return answer; } 1. finished와 todo_list에서 같은 인덱스를 사용하므로 어느 한쪽의 크기를 받아 반복문을 진행하며 원소에 접근한다. 2. todo_list의 각 값을 finished를 이용해 체크하고, 일을 마치지 못 한 경우 라면 answer에 todo_list의 해당 원소를 넣어줌. 3... 2023. 10. 30. 이전 1 다음