Recent Posts
Recent Comments
목록x사이의개수 (1)
밍쎄의 코딩공간
프로그래머스 LV.0 - x사이의 개수
import java.util.*; class Solution { public int[] solution(String myString) { ArrayList al = new ArrayList(); int cnt = 0; for(char c : myString.toCharArray()){ if(c == 'x'){ al.add(cnt); cnt = 0; } else cnt++; } al.add(cnt); int[] answer = new int[al.size()]; for(int i = 0; i < al.size(); i++){ answer[i] = al.get(i); } return answer; } } https://school.programmers.co.kr/learn/courses/30/lessons..
프로그래머스/프로그래머스 LV.0
2023. 8. 7. 21:38