YJ의 새벽
프로그래머스(0) - 암호 해독 본문
class Solution {
public String solution(String cipher, int code) {
String answer = "";
// 시작을 code 로 잡아주고, code 만큼 += 하여 추출
for(int i=code-1; i<cipher.length(); i+=code) {
answer += cipher.charAt(i);
}
return answer;
}
}
'코딩테스트연습 > 프로그래머스' 카테고리의 다른 글
프로그래머스(0) - 직각삼각형 출력하기 (0) | 2024.03.13 |
---|---|
프로그래머스(0) - 가장 큰 수 찾기 (0) | 2024.03.13 |
프로그래머스(0) - 대문자와 소문자 (0) | 2024.03.13 |
프로그래머스(0) - 가위 바위 보 (0) | 2024.03.13 |
프로그래머스(0) - n의 배수 고르기 (0) | 2024.03.13 |
Comments