- 그래프일 때는 dc, dr 사용하기. 다음에 갈 위치를 검사할 때는 nc, nr 사용하기. int dir = 0; int []di = {0, 1, 0, -1}; int []dj = {1, 0, -1, 0}; class Solution { public int[][] solution(int n) { int[][] answer = new int[n][n]; int i = 0; int j = 0; int dir = 0; int []di = {0, 1, 0, -1}; int []dj = {1, 0, -1, 0}; int number = 1; ..