Skip to content
Discussion options

You must be logged in to vote

저랑 같은 문제셨군요..ㅠㅠ

// 최단 경로 간선들 체크 
static void backtracking(int start, int dest) {
  if(dest == start) {
	  return ; 
  }
  int size = shortestPath[dest].size(); 
  for(int i = 0 ; i < size ; i ++) {
    int next = (int) shortestPath[dest].get(i); 
    if(!check[next][dest]){
      check[next][dest] = true; 
      backtracking(start,next); 
    }
  }
}

위와 같이 코드 수정하니 통과되네요

위 그림처럼 동일한 부모에 대해서 반복적으로 backtracking(start, next)를 호출하면서 생기는 문제인것같아요

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@wjdgns7712
Comment options

@yess98
Comment options

yess98 Aug 17, 2021
Maintainer Author

Answer selected by yess98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants