[프로그래머스 연습문제 level_1 ] 모의고사
import java.util.*; class Solution { public int[] solution(int[] answers) { int[] answer = {}; int[] a = {1,2,3,4,5}; // 5개 반복 int[] b = {2,1,2,3,2,4,2,5}; // 8개 반복 int[] c = {3,3,1,1,2,2,4,4,5,5}; // 10개 반복 int[] cnt = new int[3]; for(int i=0; i
2024. 1. 18.
[프로그래머스 연습문제 level_2 ] 게임 맵 최단거리
import java.util.*; class Solution { static int[][] D = {{-1,0},{1,0},{0,-1},{0,1}}; static int N, M; static class Point{ int row, col, dist; Point(int r, int c, int d){ row = r; col = c; dist = d; } } public int solution(int[][] maps) { int answer = 0; N = maps.length; M = maps[0].length; answer = bfs(maps, 0,0,N,M); return answer; } static int bfs(int[][] maps, int sRow, int sCol, int eRow, in..
2023. 11. 29.