2023. 9. 15. 22:25, 알고리즘/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/120824
#include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> v) {
int e=0;
int o=0;
for(auto c:v){
if(c%2==0) e++;
else o++;
}
vector<int> answer={e,o};
return answer;
}
'알고리즘 > 프로그래머스' 카테고리의 다른 글
Lv 0. 특정 문자 제거하기 (0) | 2023.09.16 |
---|---|
Lv 0. 문자 반복 출력하기. (0) | 2023.09.15 |
Lv 0. 직삼각형 출력하기 (0) | 2023.09.15 |
Lv 0. 문자열 뒤집기 (0) | 2023.09.15 |
Lv 0. 배열 뒤집기 - reverse() 함수는 <algorithm> 헤더에 있다. (0) | 2023.09.14 |
Comments, Trackbacks