Skip to content

[WEEK06-1] 최준호#22

Merged
raejun92 merged 1 commit intomainfrom
raejun
Mar 18, 2026
Merged

[WEEK06-1] 최준호#22
raejun92 merged 1 commit intomainfrom
raejun

Conversation

@raejun92
Copy link
Collaborator

이렇게 풀었어요

1. Maximum Depth of Binary Tree

  • 문제를 풀었어요.
  • 풀이 시간 : 9분

1) 복잡도 계산

시간 복잡도: O(n)


2) 접근 아이디어

  1. DFS 알고리즘을 이용하여 풀이했다.
  2. 왼쪽과 오른쪽의 깊이를 구해서, 그 중에서 더 큰 값을 depth에 저장하는 방식으로 풀이했다.

3) 회고

이전 DiameterofBinaryTree 문제가 이것의 상위하는 문제였던 것 같다.



2. Middle of the Linked List

  • 문제를 풀었어요.
  • 풀이 시간 : 12분

1) 복잡도 계산

시간 복잡도: O(n)


2) 접근 아이디어

  1. 링크드 리스트를 순회하면서 길이를 구했다.
  2. 길이가 홀수면 (len + 1) / 2를 구해서 len에 저장하고, 짝수면 Math.ceil((len + 1) / 2)를 구해서 len에 저장했다.
  3. len이 0이 될 때까지 node2를 node2.next로 업데이트하면서 루프를 돌았다.
  4. 루프가 끝난 후에 node2가 중간 노드를 가리키게 된다.

3) 회고

가운데 노드의 위치의 값을 이동 거리로 사용했는데, 위치의 값보다 이동거리가 더 짧기 때문에 풀이가 다소 복잡하게 되었다.
예를 들어 5개 노드의 가운데는 3번째 노드이지만, 이동 거리는 2이다.
이동 거리를 구해서 풀이하는 방식이 더 간단할 것 같다.



Copy link
Collaborator

@sik9252 sik9252 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

무서운 속도로 점점 실력이 늘고 계신것 같아요..! 대단하십니당

Copy link
Contributor

@seulgichu seulgichu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다! 빠르게 잘 푸시는군요 👍

Copy link
Member

@doitchuu doitchuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

회사 계정으로 코멘트해버렸네요... !! 고생하셨습니다 👍 잘푸시는군요

@raejun92 raejun92 merged commit b6dce40 into main Mar 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants