class Solution { public int solution(String my_string, String is_prefix) { int answer = 1; if(is_prefix.length() > my_string.length()) { answer = 0; } else { String str = my_string.substring(my_string.length() - is_prefix.length()); if(!str.equals(is_prefix)) { answer = 0; } } return answer; } } class Solution { public int solution(String my_string, String is_suffix) { if(my_string.endsWith(is_s..
class Solution { public String solution(String rny_string) { return rny_string.replace("m", "rn"); } }
class Solution { public String solution(String my_string) { String answer = ""; for(int i = 0; i < my_string.length(); i++) { if(Character.isUpperCase(my_string.charAt(i))) { answer += String.valueOf(my_string.charAt(i)).toLowerCase(); } else if (Character.isLowerCase(my_string.charAt(i))) { answer += String.valueOf(my_string.charAt(i)).toUpperCase(); } } return answer; } }
class Solution { public int solution(int[] num_list) { int answer = 1; if(num_list.length > 10 ) { for(int i = 0; i < num_list.length; i++) { answer += num_list[i]; } answer -= 1; } else { for(int i = 0; i < num_list.length; i++) { answer *= num_list[i]; } } return answer; } }
class Solution { public int[] solution(int n, int[] numlist) { int idx = 0 ; // answer index int cnt = 0 ; // numlist의 n의 배수 수 개수 for(int i = 0; i < numlist.length; i++) { if(numlist[i] % n == 0) { cnt++; } } int[] answer = new int [cnt]; for(int i = 0; i < numlist.length; i++) { if(numlist[i] % n == 0) { answer[idx] = numlist[i]; idx++; } } return answer; } }