[java] 프로그래머스 - 문자 반복 출력하기

세상을 바꾸는 개발자·2023년 3월 18일
0

[문제링크 - 프로그래머스 - 문자 반복 출력하기] https://school.programmers.co.kr/learn/courses/30/lessons/120825

class Solution {
    public String solution(String my_string, int n) {
        String answer = "";
        String[] arr = my_string.split("");
        for(int i=0; i<arr.length; i++){
           answer += arr[i].repeat(n);
            
        }
        return answer;
    }
}
profile
초심 잃지 않기

0개의 댓글