[robinyoon-dev] WEEK 04 Solutions#2465
Merged
robinyoon-dev merged 6 commits intoDaleStudy:mainfrom Mar 29, 2026
Merged
Conversation
junzero741
approved these changes
Mar 28, 2026
Comment on lines
+13
to
+23
| var maxDepth = function (root) { | ||
|
|
||
| //NOTE: 현재 노드의 최대 깊이는 왼쪽 자식 트리의 최대 깊이와 오른쪽 자식 트리의 최대 깊이 중 큰 값에 1(현재 노드)을 더한 값 | ||
| if (root === null) { | ||
| return 0; | ||
| } | ||
|
|
||
| const leftDepth = maxDepth(root.left); | ||
| const rightDepth = maxDepth(root.right); | ||
|
|
||
| return Math.max(leftDepth, rightDepth) + 1; |
Contributor
There was a problem hiding this comment.
해설 써주신 것 좋습니다! 풀이도 깔끔하구요!
Comment on lines
+15
to
+19
| if(nums[currentIndex - 1] > nums[currentIndex]){ | ||
| result = nums[currentIndex]; | ||
| }else{ | ||
| continue; | ||
| } |
Contributor
There was a problem hiding this comment.
개인 차는 있겠지만, 저는 else 문이 중괄호랑 간격이 좀 있으면 가독성이 더 좋은 것 같더라구요!
Comment on lines
+48
to
+55
| let hasCharOnTheLeft = dfs(x - 1, y, nextIndex); | ||
| let hasCharOnTheRight = dfs(x + 1, y, nextIndex); | ||
| let hasCharAtTheTop = dfs(x, y + 1, nextIndex); | ||
| let hasCharAtTheBottom = dfs(x, y - 1, nextIndex); | ||
|
|
||
| board[x][y] = tempChar; | ||
|
|
||
| return hasCharOnTheLeft || hasCharOnTheRight || hasCharAtTheTop || hasCharAtTheBottom; |
Contributor
There was a problem hiding this comment.
has~ 로 4개의 변수를 만들기보단, 1개의 변수로 줄일 수 있을 것 같아요.
const found = dfs(r + 1, c, index + 1) ||
dfs(r - 1, c, index + 1) ||
dfs(r, c + 1, index + 1) ||
dfs(r, c - 1, index + 1);
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 하나 이상을 반드시 검토를 해주셔야 합니다!