Repository navigation
[seungyeonchoi] WEEK 04 Solutions - #2970
Open
seungyeonchoi wants to merge 1 commit into
Open
seungyeonchoi wants to merge 1 commit into
seungyeonchoi wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
🤖 AI 리뷰(알고리즘 패턴, 시간/공간 복잡도, 학습 현황) 결과는 Checks 탭에서 볼 수 있어요. |
hyedall
approved these changes
Dec 5, 2026
hyedall
left a comment
Contributor
There was a problem hiding this comment.
깔끔하게 설명과 풀이를 잘 작성해주신 것 같습니다 ! 고생하셨습니다 👍
Comment on lines
+16
to
+27
| 한 칸 (r, c)에 들어왔다. 지금 word[i]를 찾는 중이다. | ||
| 1. 격자 밖인지 체크 → 밖이면 실패 | ||
| 2. 이미 방문한 곳인지 체크 → 방문했으면 실패 | ||
| 3. 타겟 글자와 동일한지 체크 → 다르면 실패 | ||
| 4. 마지막 글자였다면 → 성공 | ||
| 5. 방문 표시 | ||
| 6. 상하좌우로 word[i+1]을 찾으러 탐색 → 하나라도 성공하면 성공 | ||
| 7. 방문 표시 해제하고 실패 반환 | ||
|
|
||
| 격자의 모든 칸 (r, c)에서: | ||
| 위 과정을 i = 0으로 시작 → 성공하면 true | ||
| 전부 실패하면 false |
Contributor
There was a problem hiding this comment.
풀이 과정을 주석으로 남겨주셔서 리뷰 시에 코드를 파악하기 용이한 것 같습니다 !👍
Comment on lines
+71
to
+83
| if (backTracking(board, word, row-1, col, visited, index+1)) { | ||
| return true; | ||
| } | ||
| if (backTracking(board, word, row+1, col, visited, index+1)) { | ||
| return true; | ||
| } | ||
| if (backTracking(board, word, row, col-1, visited, index+1)) { | ||
| return true; | ||
| } | ||
| if (backTracking(board, word, row, col+1, visited, index+1)) { | ||
| return true; | ||
| } | ||
| visited[row][col] = false; |
Contributor
There was a problem hiding this comment.
하나의 visited를 재사용하면서 방문 기록을 복구해 시간복잡도를 개선할 수 있다는 점을 배웠습니다!
상하좌우 탐색 시 방향 배열을 활용하여 중복되는 코드를 줄이는 방식도 고려해보면 좋을 것 같습니다 😊
parkhojeong
approved these changes
Dec 5, 2026
parkhojeong
left a comment
Collaborator
There was a problem hiding this comment.
수고하셨습니다! 가독성 관련 커멘트 하나 남깁니다~
Comment on lines
+71
to
+82
| if (backTracking(board, word, row-1, col, visited, index+1)) { | ||
| return true; | ||
| } | ||
| if (backTracking(board, word, row+1, col, visited, index+1)) { | ||
| return true; | ||
| } | ||
| if (backTracking(board, word, row, col-1, visited, index+1)) { | ||
| return true; | ||
| } | ||
| if (backTracking(board, word, row, col+1, visited, index+1)) { | ||
| return true; | ||
| } |
Collaborator
There was a problem hiding this comment.
반복문 활용해서 이런 형태로 개선할 수 있을 거 같아요.
for dx, dy in [(-1,0), (1,0), (0,-1), (0,1)]:
if (backTracking(board, word, row+dx, col+dy, visited, index+1) return true
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!
🤖 Generated with Claude Code