본문 바로가기

알고리즘/프로그래머스 1단계42

[프로그래머스] 문자열 내림차순으로 배치하기 프로그래머스 1단계 문자열 내림차순으로 배치하기 https://programmers.co.kr/learn/challenges 문제 설명 풀이 import java.util.*; class Solution { public String solution(String s) { String answer = ""; String str[] = s.split(""); Arrays.sort(str); for(int i=0; i 2022. 4. 25.
[프로그래머스] 없는 숫자 더하기 프로그래머스 1단계 없는 숫자 더하기 https://programmers.co.kr/learn/challenges 문제 설명 풀이 class Solution { public int solution(int[] numbers) { int answer = 45; for (int number : numbers) { answer -= number; } return answer; } } 2022. 4. 25.
[프로그래머스] 정수 내림차순으로 배치하기 프로그래머스 1단계 정수 내림차순으로 배치하기 https://programmers.co.kr/learn/challenges 문제 설명 풀이 import java.util.*; class Solution { public long solution(long n) { String stringnum = String.valueOf(n); String nn = ""; String numbers[] = stringnum.split(""); Arrays.sort(numbers); String sortnumbers[] = new String[numbers.length]; for(int i=0; i< numbers.length; i++) { sortnumbers[i] = numbers[numbers.length-1-i]; .. 2022. 4. 25.
[프로그래머스] 비밀지도 프로그래머스 1단계 비밀지도 https://programmers.co.kr/learn/challenges 문제 설명 풀이 class Solution { public String[] solution(int n, int[] arr1, int[] arr2) { String answer[] = new String[n]; String binaryArr[] = new String[n]; for(int i=0; i 2022. 4. 25.