문제
오늘 해야 할 일이 담긴 문자열 배열 todo_list와 각각의 일을 지금 마쳤는지를 나타내는 boolean 배열 finished가 매개변수로 주어질 때, todo_list에서 아직 마치지 못한 일들을 순서대로 담은 문자열 배열을 return 하는 solution 함수를 작성해 주세요.
솔루션
#include <string>
#include <vector>
using namespace std;
vector<string> solution(vector<string> todo_list, vector<bool> finished) {
vector<string> answer;
for(int i = 0; i < todo_list.size(); i++){
if(!finished[i]){
answer.push_back(todo_list[i]);
}
}
return answer;
}
https://school.programmers.co.kr/learn/courses/30/lessons/181885
프로그래머스
SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프
programmers.co.kr
'프로그래머스코딩테스트연습풀이 > C++' 카테고리의 다른 글
[프로그래머스/C++] 홀수 vs 짝수 (0) | 2025.02.15 |
---|---|
[프로그래머스/C++] 5명씩 (0) | 2025.02.15 |
[프로그래머스/C++] n보다 커질 때까지 더하기 (0) | 2025.02.15 |
[프로그래머스/C++] 조건에 맞게 수열 변환하기 1 (0) | 2025.02.15 |
[프로그래머스/C++] 길이에 따른 연산 (0) | 2025.02.15 |