본문 바로가기
알고리즘 문제풀이/Programmers - 자바

프로그래머스 - 암호 해독

by 올리브영 2023. 3. 4.
728x90
반응형
class Solution {
    public String solution(String cipher, int code) {
        StringBuilder sb = new StringBuilder();
        for(int i=code-1; i<cipher.length(); i+=code){
            sb.append(cipher.charAt(i));
        }
        return sb.toString();
    }
}

 

728x90
반응형