Level 0. 문자 개수 세기
#include <iostream>
#include <vector>
using namespace std;
vector<int> solution(string my_string)
{
vector<int> answer(52, 0);
for (char c : my_string)
++answer[c - (isupper(c) ? 'A' : 'G')];
return answer;
}
'자료구조 & 알고리즘 > 프로그래머스' 카테고리의 다른 글
Level 0. 1로 만들기 (0) | 2023.05.26 |
---|---|
Level 0. 배열 만들기 5 (0) | 2023.05.25 |
Level 2. 연속된 부분 수열의 합 (0) | 2023.05.23 |
Level 0. 문자열 잘라서 정렬하기 (0) | 2023.05.22 |
Level 0. 세로 읽기 (0) | 2023.05.21 |