본문 바로가기

분류 전체보기201

[코딩 기초 트레이닝] 뒤에서 5등까지 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181853 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] num_list) { return Arrays.stream(num_list).sorted().limit(5).toArray(); } } 다른 사람 풀이 : import java.util.Arrays; class Solution { public int[] solut.. 2024. 2. 6.
[코딩 기초 트레이닝] 배열의 길이에 따라 다른 연산하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181854 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int[] solution(int[] arr, int n) { int len = arr.length; if(len%2 == 0){ for(int i = 0; i 2024. 2. 6.
[코딩 기초 트레이닝] 배열 비교하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181856 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int solution(int[] arr1, int[] arr2) { int sum1 = 0; int sum2 = 0; if(arr1.length arr2.length){ return 1; }else{ sum1 .. 2024. 2. 5.
[코딩 기초 트레이닝] 배열의 길이를 2의 거듭제곱으로 만들기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181857 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] arr) { int length = 1; while (length < arr.length) { length *= 2; } return Arrays.copyOf(arr, length); } } 다른 사람 풀이 : class Solution { public int[].. 2024. 2. 5.
[코딩 기초 트레이닝] 무작위로 K개의 수 뽑기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181858 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] arr, int k) { List answer = new ArrayList(); for(int i = 0; ii).toArray(); } } 2024. 2. 5.
[코딩 기초 트레이닝] 배열 만들기6 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181859 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] arr) { List stk = new ArrayList(); int i = 0; while(i< arr.length){ if(stk.size() == 0){ stk.add(arr[i]); i++; }else if(stk.get(stk.size()-1) == ar.. 2024. 2. 4.
[코딩 기초 트레이닝] 빈 배열에 추가, 삭제하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181860 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] arr, boolean[] flag) { List x = new ArrayList(); for(int i = 0; i 2024. 2. 4.
[MariaDB] 중복, NULL, 유효하지 않은 고객 제거하는 쿼리 1. 중복 제거 쿼리 SELECT CUST_ID, COUNT(CUST_ID) AS CNT, '중복' AS REASON FROM C_CUST_ADD_ITEMP WHERE CUSTG_ID = {CUSTG_ID} GROUP BY CUST_ID HAVING COUNT(CUST_ID)>1 2. NULL 제거 쿼리 SELECT CUST_ID, COUNT(CUST_ID) AS CNT, 'NULL' FROM C_CUST_ADD_ITEMP WHERE CUSTG_ID = {CUSTG_ID} AND (CUST_ID = '' OR CUSTG_ID IS NULL) 3. TG_CUST_BHCRD_DD 테이블에 존재하지 않는 CUST_ID를 C_CUST_ADD_ITEMP 테이블에서 제거하는 쿼리 SELECT CUST_ID, COU.. 2024. 2. 1.
[코딩 기초 트레이닝] 가까운 1 찾기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181898 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(int[] arr, int idx) { int answer = -1; for(int i=idx; i 2024. 1. 24.
[코딩 기초 트레이닝] 카운트 다운 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181899 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int start_num, int end_num) { List list = new ArrayList(); for(int i =0 ; i 2024. 1. 24.
[코딩 기초 트레이닝] 글자 지우기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181900 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public String solution(String my_string, int[] indices) { String answer = ""; String[] str = my_string.split(""); for(int i=0; i 2024. 1. 24.
[코딩 기초 트레이닝] 배열 만들기 1 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181901 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int n, int k) { List li = new ArrayList(); for( int i=1; ii).toArray(); } } 2024. 1. 24.