내 답안
class Solution {
public String solution(int q, int r, String code) {
StringBuilder answer = new StringBuilder();
for (int i = r; i < code.length(); i += q) {
answer.append(code.charAt(i));
}
return answer.toString();
}
}
Java
복사
다른사람 풀이
class Solution {
public int[] solution(String my_string) {
int[] answer = new int[52];
for(int i = 0; i < my_string.length(); i++){
char c = my_string.charAt(i);
if(c >= 'a')
answer[c - 'a' + 26]++;
else
answer[c - 'A']++;
}
return answer;
}
}
Java
복사
class Solution {
public String solution(String my_string, int s, int e) {
char[] arr = my_string.toCharArray();
while (s < e) {
char temp = arr[s];
arr[s++] = arr[e];
arr[e--] = temp;
}
return new String(arr);
}
}
Java
복사