class Solution { public int solution(int n) { int answer = 0; while (n > 0) { answer += n % 10; n /= 10; } return answer; } }
class Solution { public int solution(String[] s1, String[] s2) { int answer = 0; for(int i = 0; i < s1.length; i++) { for(int j = 0; j < s2.length; j++) { if (s1[i].equals(s2[j])) { answer++; } } } return answer; } }
class Solution { public int solution(int[] array) { int answer = 0; for(int i = 0; i array[j]) { int tmp = array[j]; array[j] = array[i]; array[i] = tmp; } } } answer = array.length / 2; return array[answer]; } }
class Solution { public int[] solution(int money) { int[] answer = new int [2]; answer[0] = money / 5500; answer[1] = money % 5500; return answer; } }
class Solution { public int[] solution(int[] numbers) { int[] answer = new int [numbers.length]; for(int i = 0; i < numbers.length; i++) { answer[i] = numbers[i] * 2; } return answer; } }