전체 글88 자릿수 더하기 풀이 import java.util.*; public class Solution { public int solution(int n) { int answer = 0; String s = n+""; String[] a = s.split(""); for(int i=0; i 2024. 2. 7. 자연수 뒤집어 배열로 만들기 풀이 import java.util.*; class Solution { public int[] solution(long n) { // long n = {12345}; String s = n+""; String[] s2 = s.split(""); int[] answer = new int[s.length()]; Stack stack = new Stack(); for(String x:s2){ stack.push(x); } for(int i=0; i 2024. 2. 7. 정수 내림차순으로 배치하기 풀이 import java.util.*; class Solution { public long solution(long n) { long answer = 0; String[] a = Long.toString(n).split(""); Arrays.sort(a); String aa = ""; for (long i = a.length - 1; i >= 0; i--) { aa += a[(int) i]; } answer = Long.parseLong(aa); return answer; } } 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 2024. 2. 7. 정수 제곱근 판별 풀이 class Solution { public long solution(long n) { long answer = -1; for(long i=1; i 2024. 2. 7. 제일 작은 수 제거하기 풀이 import java.util.*; class Solution { public int[] solution(int[] n) { ArrayList list = new ArrayList(); int[] answer = null; if(n.length > 1) { int min = n[0]; for(int i=1; i= n[i]){ min = n[i]; } } for(int i=0; i 2024. 2. 6. 짝수와 홀수 풀이 class Solution { public String solution(int num) { String answer = ""; if(num%2 == 0){ answer = "Even"; }else{ answer ="Odd"; } return answer; } } 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 2024. 2. 6. 이전 1 2 3 4 5 6 7 ··· 15 다음