코딩테스트/프로그래머스 - LV 0
[프로그래머스] 문자열 섞기
웅드
2024. 1. 22. 17:33
- 풀이
#include <string>
#include <vector>
using namespace std;
string solution(string str1, string str2) {
string answer = "";
int n = str1.size() + str2.size();
for(int i=0; i<n; i++){
if(i % 2 == 0) answer += str1[i/2];
else answer+= str2[i/2];
}
return answer;
}
반응형