전체 글

전체 글

    프로그래머스 게임 맵 최단 거리

    프로그래머스 게임 맵 최단 거리

    프로그래머스 게임 맵 최단거리 풀이 시작점을 기준으로 bfs 돌려서 큐에 넣을 때마다 이전거리 + 1씩 해줘서 넣어준다. 도착지점 거리를 리턴해준다 내가 푼 풀이 import java.util.*; class Pos{ int x; int y; public Pos(int y, int x) { this.y = y; this.x = x;} } class Solution { static int dx[] = {0, 0, -1, 1}; static int dy[] = {-1, 1, 0, 0}; static int visited[][]; public int solution(int[][] maps) { return bfs(maps,new Pos(0,0)); } public static int bfs(int[][] ma..