[프로그래머스/Java] Lv.0 대문자로 바꾸기 문제 풀이 1 2 3 4 5 class Solution { public String solution(String myString) { return myString.toUpperCase(); } } Colored by Color Scripter cs [JAVA] 프로그래머스 스쿨/Java Lv.0 약 1년 전
[프로그래머스/Java] Lv.0 원하는 문자열 찾기 문제 풀이 1 2 3 4 5 6 class Solution { public int solution(String myString, String pat) { return myString.toLowerCase().indexOf(pat.toLowerCase()) != -1 ? 1 : 0; } } Colored by Color Scripter cs [JAVA] 프로그래머스 스쿨/Java Lv.0 약 1년 전
[프로그래머스/Java] Lv.0 길이에 따른 연산 문제 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 import java.util.Arrays; class Solution { public int solution(int[] num_list) { if (num_list.length >= 11) { return Arrays.stream(num_list).sum(); } else { return Arrays.stream(num_list).reduce(1, (a, b) -> a * b); } } } Colored by Color Scripter cs [JAVA] 프로그래머스 스쿨/Java Lv.0 약 1년 전
[프로그래머스/Java] Lv.0 조건에 맞게 수열 변환하기 1 문제 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import java.util.Arrays; class Solution { public int[] solution(int[] arr) { return Arrays.stream(arr) .map(value -> { if (value >= 50 && value % 2 == 0) { return value / 2; } else if (value [JAVA] 프로그래머스 스쿨/Java Lv.0 약 1년 전
[프로그래머스/Java] Lv.0 n보다 커질 때까지 더하기 문제 풀이 1 2 3 4 5 6 7 8 9 10 class Solution { public int solution(int[] numbers, int n) { int answer = 0; for (int i : numbers) { if (answer > n) return answer; answer += i; } return answer; } } Colored by Color Scripter cs [JAVA] 프로그래머스 스쿨/Java Lv.0 약 1년 전
[프로그래머스/Java] Lv.0 할 일 목록 문제 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 import java.util.Arrays; import java.util.stream.IntStream; class Solution { public String[] solution(String[] todo_list, boolean[] finished) { long falseCount = IntStream.range(0, finished.length) .filter(index -> !finished[index]) .count(); String[] answer = new String[(int) falseCount]; int idx = 0; for (int i = 0; i [JAVA] 프로그래머스 스쿨/Java Lv.0 약 1년 전
[프로그래머스/Java] Lv.0 5명씩 문제 풀이 1 2 3 4 5 6 7 8 9 10 11 class Solution { public String[] solution(String[] names) { String[] answer = new String[(int)Math.ceil(names.length/5.0)]; int idx = 0; for (int i = 0; i [JAVA] 프로그래머스 스쿨/Java Lv.0 약 1년 전
[프로그래머스/Java] Lv.0 홀수 vs 짝수 문제 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 class Solution { public int solution(int[] num_list) { int even = 0; int odd = 0; for (int i = 0; i [JAVA] 프로그래머스 스쿨/Java Lv.0 약 1년 전