[프로그래머스] 글자 지우기

Seah Lee·2023년 6월 29일
0

프로그래머스

목록 보기
54/57

import java.util.Arrays;

class Solution {
    public String solution(String my_string, int[] indices) {
        StringBuilder sb = new StringBuilder(my_string);
        Arrays.sort(indices);
        for (int i = indices.length - 1; i >= 0; i--) {
            int index = indices[i];
            sb.deleteCharAt(index);
        }
        
        return sb.toString();
    }
}
profile
성장하는 개발자

0개의 댓글