본문 바로가기

코딩 기초 트레이닝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.
[코딩 기초 트레이닝] 배열 만들기 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.
[코딩 기초 트레이닝] 순서 바꾸기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181891 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] num_list, int n) { List list = new ArrayList(); for(int i = n; i 2024. 1. 23.
[코딩 기초 트레이닝] 세 개의 구분자 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181862 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public String[] solution(String myStr) { List answer = new ArrayList (); String temp = ""; for(int i = 0; i !str.isEmpty()).toArray(String[]::new); return arr.length == 0 ? ne.. 2024. 1. 16.
[코딩 기초 트레이닝] 문자열 바꿔서 찾기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181864 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 틀렸던 해결 방안 : class Solution { public int solution(String myString, String pat) { int answer = 0; String[] str = myString.split(""); for(int i = 0; i 2024. 1. 14.
[코딩 기초 트레이닝] 조건에 맞게 수열 변환하기 3 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181835 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int[] solution(int[] arr, int k) { if(k%2 == 0){ for(int i = 0; i 2024. 1. 5.
[코딩 기초 트레이닝] 특정 문자열로 끝나는 가장 긴 부분 문자열 찾기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181872 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public String solution(String myString, String pat) { String fin = ""; int num = myString.lastIndexOf(pat); fin = myString.substring(0, num) + pat; return fin; } } 2024. 1. 4.
[코딩 기초 트레이닝] 특정한 문자를 대문자로 바꾸기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181873 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public String solution(String my_string, String alp) { my_string = my_string.replaceAll(alp, alp.toUpperCase()); return my_string; } } 2024. 1. 3.
[코딩 기초 트레이닝] 배열에서 문자열 대소문자 변환하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181875 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public String[] solution(String[] strArr) { for(int i=0; i 2024. 1. 2.
[코딩 기초 트레이닝] 조건에 맞게 수열 변환하기 2 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181881 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(int[] arr) { int[] before = new int[arr.length]; int cnt = 0; int answer = 0; while(cnt != arr.length){ cnt = 0; before = arr.clone(); for(int i = 0; i=50 && arr[i]%2 == 0){ a.. 2024. 1. 2.
[코딩 기초 트레이닝] 1로 만들기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181880 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(int[] num_list) { int cnt = 0; for(int i = 0; ii;i++){ while(num_list[i]!=1){ num_list[i]/=2; answer++; } } return answer; } } int 타입이라 /2만 해줘도 된다. 2024. 1. 2.
[코딩 기초 트레이닝] 소문자로 바꾸기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181850 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public String solution(String myString) { String answer = ""; answer = myString.toLowerCase(); return answer; } } 2024. 1. 1.