코딩테스트/프로그래머스 - LV 0

[프로그래머스] 문자열 묶기

웅드 2024. 2. 1. 21:06

 

 

  • 풀이
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int solution(vector<string> strArr) {
    int answer = 0;
    vector<int> size(30,0);
    for(int i=0; i<strArr.size(); i++){
        size[strArr[i].length()-1]++;
    }
    sort(size.begin(), size.end(), greater<int>());
    return size[0];
}
반응형