[jangwonyoon] WEEK04 solutions#1835
Merged
jangwonyoon merged 5 commits intoDaleStudy:mainfrom Aug 17, 2025
Merged
Conversation
seungriyou
approved these changes
Aug 17, 2025
| - n: list1의 길이, m: list2의 길이 | ||
|
|
||
| * 공간 복잡도(SC): O(n + m) | ||
| - 재귀 호출 시 스택 메모리가 최대 n+m 깊이까지 쌓일 수 있음 |
Contributor
There was a problem hiding this comment.
적어두신 것처럼 재귀로 풀면 콜 스택으로 인해 공간 복잡도가 O(n + m)이 됩니다! 그래서 저는 링크드리스트 문제는 반복문으로도 한 번 더 풀어보는 편인데요, 코드가 조금 더 복잡해지기는 하지만 공간 복잡도를 O(1)으로 줄일 수 있기 때문입니다. 여유가 되신다면 반복문으로도 풀어보시는 걸 추천드려요~!
Contributor
Author
There was a problem hiding this comment.
오오 감사합니다!! 반복문으로더 풀어볼게요
| * | ||
| * 문제 풀이 방법: | ||
| * 1. 배열을 이진 탐색으로 탐색 | ||
| */ |
Contributor
There was a problem hiding this comment.
각 풀이별로 복잡도 분석과 풀이법을 정리해주셔서 리뷰어 입장에서도 이해가 쉬웠고, 풀이하시는 과정에서도 공부가 많이 되셨을 것 같습니다!
| // 2) 가드: 범위/문자/방문 상태 확인 | ||
| if (r < 0 || r >= rows || c < 0 || c >= cols) return false; | ||
| if (board[r][c] !== word[idx]) return false; | ||
| if (board[r][c] === '#') return false; // 이미 방문했으면 탈락 |
Contributor
There was a problem hiding this comment.
저는 주로 dfs에서 조건을 확인할 때 여러 조건들을 모두 or로 연결하곤 했었는데요, 각 조건이 각각 라인별로 적혀있으니 오히려 훨씬 가독성도 좋고 디버깅하기가 쉬워보이네요! 덕분에 배워갑니다~!
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 하나 이상을 반드시 검토를 해주셔야 합니다!