본문 바로가기

분류 전체보기201

[코딩 기초 트레이닝] 문자 개수 세기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181902 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int[] solution(String my_string) { int[] answer = new int[52]; char[] arr = my_string.toCharArray(); for( char c : arr ){ int idx = c < 'a' ? c-65 : c-71; answer[idx]++; } return answer; } } 2024. 1. 24.
[코딩 기초 트레이닝] 배열의 원소만큼 추가하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181861 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] arr) { List answer = new ArrayList(); int x = 0; for(int i = 0; i 2024. 1. 23.
[코딩 기초 트레이닝] 첫 번째로 나오는 음수 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181896 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.stream.IntStream; class Solution { public int solution(int[] num_list) { return IntStream.range(0,num_list.length).filter(i->num_list[i] < 0).findFirst().orElse(-1); } } 2024. 1. 23.
[코딩 기초 트레이닝] 2의 영역 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181894 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] arr) { List list = new ArrayList(); for(int i =0; i 2024. 1. 23.
[코딩 기초 트레이닝] n번째 원소부터 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181892 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] num_list, int n) { num_list = Arrays.copyOfRange(num_list, n-1, num_list.length); return num_list; } } 2024. 1. 23.
[코딩 기초 트레이닝] 순서 바꾸기 문제 : 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/181890 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public String[] solution(String[] str_list) { String[] answer = {}; for (int i = 0; i < str_list.length;i++) { if (str_list[i].equals("l")) { return Arrays.copyOfRange(str_lis.. 2024. 1. 23.
[코딩 기초 트레이닝] 공백으로 구분하기 1 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181869 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public String[] solution(String my_string) { String[] answer = my_string.split(" "); return answer; } } 2024. 1. 22.
[코딩 기초 트레이닝] 세 개의 구분자 문제 : 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.
[코딩 기초 트레이닝] rny_string 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181863 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public String solution(String rny_string) { String answer = ""; for(int i =0; i 2024. 1. 15.
[코딩 기초 트레이닝] 문자열 바꿔서 찾기 문제 : 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.
[코딩 기초 트레이닝] 간단한 식 계산하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181865 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(String binomial) { int answer = 0; String[] num = binomial.split(" "); int a = Integer.parseInt(num[0]); String op = num[1]; int b = Integer.parseInt(num[2]); if(op.equals("+".. 2024. 1. 14.