본문 바로가기

전체 글206

[코딩 기초 트레이닝] 문자열의 앞의 n글자 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181907 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public String solution(String my_string, int n) { return my_string.substring(0,n); } } 2024. 2. 12.
[코딩 기초 트레이닝] 이차원 배열 대각선 순회하기 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181829 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(int[][] board, int k) { int answer = 0; for(int i = 0; i 2024. 2. 10.
[코딩 기초 트레이닝] 커피 심부름 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181837 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int solution(String[] order) { int answer = 0; for(String menu : order){ if(menu.contains("americano") || menu.contains("anything")){ answer += 4500; }else{ answer += 5000; } } return answ.. 2024. 2. 10.
[코딩 기초 트레이닝] 특별한 이차원 배열 1 문제 : https://school.programmers.co.kr/learn/courses/30/lessons/181833 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 해결 : class Solution { public int[][] solution(int n) { int[][] answer = new int[n][n]; for(int i = 0; i 2024. 2. 10.
[코딩 기초 트레이닝] 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.