본문 바로가기

분류 전체보기202

[코딩 기초 트레이닝] l로 만들기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181834 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public String solution(String myString) { String answer = ""; return answer = myString.replaceAll("[a-k]","l"); } } 다른 사람 풀이 : class Solution { public String solution(String myString) { String an.. 2024. 2. 10.
[코딩 기초 트레이닝] 꼬리 문자열 문제 :https://school.programmers.co.kr/learn/courses/30/lessons/181841 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr 해결 :import java.util.*;class Solution { public String solution(String[] str_list, String ex) { StringBuilder answer = new StringBuilder(); for(String str : str_list){ if(str.contains(e.. 2024. 2. 10.
[코딩 기초 트레이닝] 주사위 게임1 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181839 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(int a, int b) { int answer = 0; int num1 = a%2; int num2 = b%2; if(num1 == 1 && num2 == 1){ answer = a*a + b*b; }else if(num1 == 0 && num2 == 0){ answer = Math.abs(a-b); }else.. 2024. 2. 10.
[코딩 기초 트레이닝] 0 떼기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181847 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public String solution(String n_str) { while(n_str.substring(0,1).equals("0")) { n_str = n_str.substring(1,n_str.length()); } return n_str; } } 다른 사람 풀이 : class Solution { public String solution(.. 2024. 2. 10.
[코딩 기초 트레이닝] 배열의 원소 삭제하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181844 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] arr, int[] delete_list) { List list = new ArrayList(); for(int num : arr){ list.add(num); } for(int del : delete_list){ int index = list.indexOf(de.. 2024. 2. 10.
[코딩 기초 트레이닝] 두 수의 합 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181846 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 에러 : class Solution { public String solution(String a, String b) { int a1 = Integer.parseInt(a); int a2 = Integer.parseInt(b); int sum = a1+a2; return a1+a2+""; } } int자료형으로는 큰 수를 담을 수 없어서 나는 에러. Exception in thread ".. 2024. 2. 7.
[코딩 기초 트레이닝] 부분 문자열 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181842 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(String str1, String str2) { int answer = 0; return answer; } } 2024. 2. 7.
[코딩 기초 트레이닝] 날짜 비교하기 | LocalDate API 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181838 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(int[] date1, int[] date2) { int answer = 0; for(int i = 0; i date2[i]){ answer = .. 2024. 2. 7.
[코딩 기초 트레이닝] 부분 문자열인지 확인하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181843 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(String my_string, String target) { if(my_string.contains(target)){ return 1; }else{ return 0; } } } 2024. 2. 7.
[코딩 기초 트레이닝] 문자열을 정수로 변환하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181848 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(String n_str) { return Integer.parseInt(n_str); } } 2024. 2. 6.
[코딩 기초 트레이닝] 문자열 정수의 합 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181849 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(String num_str) { String[] arr =num_str.split(""); int[] num = new int[arr.length]; int sum = 0; for(int i =0; i 2024. 2. 6.
[코딩 기초 트레이닝] 뒤에서 5등 위로 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181852 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : import java.util.*; class Solution { public int[] solution(int[] num_list) { Arrays.sort(num_list); int[] arr = new int[num_list.length-5]; for(int i = 0; i 2024. 2. 6.