백트래킹
-
[알고리즘] 스도쿠 2 - 스도쿠 풀이 (백트래킹, DFS)개발 공부/Algorithm 2020. 12. 11. 07:38
leetcode.com/problems/sudoku-solver/ Sudoku Solver - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 백트래킹이란, 맞는 답을 먼저 찾는 대신 일단 후보를 입력하고 답인것 처럼 진행하다가 조건이 안맞는 경우가 생기면 다시 되돌아와서 다른 후보값을 입력하는 방식으로 답을 찾는 알고리즘이다. 가지치기 (pruning) 처럼 답이 아닌 것들을 후보에서 제거하여 경우의 수를 줄여나가 답을 찾는 접근 recursive 를 사용하는 ..