프로그래머스 181875 배열에서 문자열 대소문자 변환하기

1 개요[ | ]

프로그래머스 181875 배열에서 문자열 대소문자 변환하기

2 C++[ | ]

C++
Copy
#include <string>
#include <vector>

using namespace std;

vector<string> solution(vector<string> strArr) {
    for(int i=0; i<strArr.size(); i++) {
        if(i%2==0) {
            for(char& ch: strArr[i]) ch = tolower(ch);
        } else {
            for(char& ch: strArr[i]) ch = toupper(ch);
        }
    }
    return strArr;
}