코딩테스트 96

[programmers] 달리기 경주

https://school.programmers.co.kr/learn/courses/30/lessons/178871 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr calling이 최대 1,000,000 이기 때문에 calling 단독 for문이 돌고 그 안에서 문제를 해결해야한다. swap 코드 대신 ArrayList의 set을 사용한 코드 import java.util.*; class Solution { public String[] solution(String[] players, String[] callings) { String[] answer = {}..

코딩테스트 2024.04.13

[programmers] 게임 맵 최단거리

https://school.programmers.co.kr/learn/courses/30/lessons/1844 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr dfs로 푼 풀이 바로 떠올라서 풀었던 부분 import java.util.*; class Solution { static int n, m; static int[][] routes; static int[][] maps1; public int solution(int[][] maps) { int answer = 0; n = maps.length; m = maps[0].length; routes = ne..

코딩테스트 2024.03.31

[programmers][PCCE] 9. 이웃한 칸

https://school.programmers.co.kr/learn/courses/30/lessons/250125 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 내멋대로 풀기 굳이..4방향만 확인하는데 문제에 나온 것처럼 배열만들고 해야하나 싶어서 아래와 같이 확인 class Solution { public int solution(String[][] board, int h, int w) { int answer = 0; String color = board[h][w]; if (h - 1 > -1 && color.equals(board[h - 1][w..

코딩테스트 2024.03.24

[programmers][PCCP] 2번 / 석유 시추

https://school.programmers.co.kr/learn/courses/30/lessons/250136 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 1. 전수 조사 석유덩어리를 구분하기 위해 같은 덩어리일 경우 같은 숫자로 변경 2. 시추관을 하나씩 내려서 조사하기 import java.util.*; class Solution { public int solution(int[][] land) { int answer = 0; int index = 2; Map map = new HashMap(); map.put(0, 0); int n = land..

코딩테스트 2024.03.21

[programmers][PCCE 기출문제] 10번 / 데이터 분석

https://school.programmers.co.kr/learn/courses/30/lessons/250121# 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr import java.util.*; class Solution { public int[][] solution(int[][] data, String ext, int val_ext, String sort_by) { int indexExt = -1; int indexSort = -1; if (ext.equals("code")){ indexExt = 0; } else if (ext.equals("da..

코딩테스트 2024.03.13