Level 0. 수 조작하기 2
#include <iostream>
#include <vector>
using namespace std;
string solution(vector<int> numLog)
{
size_t n = numLog.size() - 1;
string answer(n, '\0');
const char* wasd = "d w s a";
for (int i = 0; i < n; ++i)
answer[i] = wasd[numLog[i] - numLog[i + 1] + 10];
return answer;
}
'자료구조 & 알고리즘 > 프로그래머스' 카테고리의 다른 글
Level 2. 다리를 지나는 트럭 (0) | 2023.06.26 |
---|---|
Level 0. 특별한 이차원 배열 2 (0) | 2023.06.25 |
Level 0. 가까운 1 찾기 (0) | 2023.06.23 |
Level 2. 2 x n 타일링 (0) | 2023.06.22 |
Level 0. 등차수열의 특정한 항만 더하기 (0) | 2023.06.21 |