프로그래머스코딩테스트연습풀이/C++
[프로그래머스/C++] 중복된 숫자 개수
코코쵸마
2025. 2. 13. 00:19
문제
정수가 담긴 배열 array와 정수 n이 매개변수로 주어질 때, array에 n이 몇 개 있는 지를 return 하도록 solution 함수를 완성해보세요.
솔루션
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> array, int n) {
return count(array.begin(), array.end(), n);
}
https://school.programmers.co.kr/learn/courses/30/lessons/120583