본문 바로가기
C++

[프로그래머스] 짝수 홀수 개수

by 띰쥬 2025. 9. 2.
728x90
반응형
SMALL

#include <string>
#include <vector>

using namespace std;

vector<int> solution(vector<int> num_list) {
    vector<int> answer = {0,0};
    
    for(auto n:num_list)
        n%2==0 ? answer[0]++:answer[1]++;
    
    return answer;
}

728x90
반응형
LIST

'C++' 카테고리의 다른 글

[프로그래머스] 편지  (0) 2025.09.02
[프로그래머스] 뒤집힌 문자열  (0) 2025.09.02
[프로그래머스] 배열 뒤집기  (0) 2025.09.02
[프로그래머스] 짝수의 합  (0) 2025.09.02
[프로그래머스] 양꼬치  (0) 2025.09.02

댓글