목록프로그래머스/프로그래머스 LV.0 (19)
밍쎄의 코딩공간
import java.util.*; class Solution { public String[] solution(String[] names) { ArrayList list = new ArrayList(); for(int i = 0; i < names.length; i += 5){ list.add(names[i]); } String[] answer = new String[list.size()]; for(int i = 0; i < list.size(); i++) answer[i] = list.get(i); return answer; } } https://school.programmers.co.kr/learn/courses/30/lessons/181886 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지..
class Solution { public int[] solution(int[] arr, int[][] queries) { for(int[] x : queries){ int tmp = arr[x[0]]; arr[x[0]] = arr[x[1]]; arr[x[1]] = tmp; } return arr; } } https://school.programmers.co.kr/learn/courses/30/lessons/181924 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr
class Solution { public int[] solution(int start, int end) { int[] answer = new int[start-end+1]; int pos = 0; for(int i = start; i >= end; i--) answer[pos++] = i; return answer; } } https://school.programmers.co.kr/learn/courses/30/lessons/181899 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr
import java.util.*; class Solution { public String[] solution(String my_string) { String[] answer = new String[my_string.length()]; for(int i = 0; i < my_string.length(); i++){ answer[i] = my_string.substring(i); } Arrays.sort(answer); return answer; } } https://school.programmers.co.kr/learn/courses/30/lessons/181909 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는..
class Solution { public int[] solution(int n, int k) { int len = n / k; int[] answer = new int[len]; int pos = 0; for(int i = k; i
class Solution { public int solution(int[] num_list) { int answer = 0; String a="", b=""; for(int x : num_list){ if(x % 2 == 1) a += Integer.toString(x); else b += Integer.toString(x); } answer = Integer.parseInt(a) + Integer.parseInt(b); return answer; } } https://school.programmers.co.kr/learn/courses/30/lessons/181928 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘..