Skip to content

[Hyun] Week 8 Solution Explanation #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 29, 2024

Conversation

WhiteHyun
Copy link
Member

@WhiteHyun WhiteHyun commented Jun 27, 2024

230. Kth Smallest Element in a BST

Complexities πŸ“ˆ

  • Time Complexity: $O(n)$
  • Space Complexity: $O(log n)$

Explanation πŸ“

μ™Όμͺ½ μžμ‹λ…Έλ“œ -> μžμ‹  -> 였λ₯Έμͺ½ μžμ‹ λ…Έλ“œλ‘œ 순차 ν™•μΈν•˜λŠ” λŠλ‚ŒμœΌλ‘œ μ ‘κ·Όν•˜μ—¬ μž¬κ·€μ μœΌλ‘œ μ²˜λ¦¬ν–ˆμŠ΅λ‹ˆλ‹€.

105. Construct Binary Tree from Preorder and Inorder Traversal

Complexities πŸ“ˆ

  • Time Complexity: $O(n)$
  • Space Complexity: $O(n)$

Explanation πŸ“

κ½€λ‚˜ 생각을 μš”ν–ˆλ˜ λ¬Έμ œμ—¬μ„œ 재밌게 ν’€μ—ˆμŠ΅λ‹ˆλ‹€ γ…Žγ…Ž DaleSeoλ‹˜μ˜ 글을 많이 μ°Έκ³ ν–ˆλ„€μš” ☺️
preorder: root -> left -> right
inorder: left -> root -> right
μœ„ νŠΉμ„±μ— 맞게 preorder의 첫 번째 값이 inorder에 어디에 μœ„μΉ˜ν•˜λŠ”μ§€μ— λ”°λΌμ„œ left와 right λ¦¬ν”„λ…Έλ“œλ₯Ό μ²˜λ¦¬ν•  수 μžˆμŠ΅λ‹ˆλ‹€. 이런 νŠΉμ„±μ„ 톡해 문제λ₯Ό μž¬κ·€μ μœΌλ‘œ ν’€μ΄ν–ˆμŠ΅λ‹ˆλ‹€.

39. Combination Sum

Complexities πŸ“ˆ

  • Time Complexity: $O(2^n)$
  • Space Complexity: $O(n)$

Explanation πŸ“

λ°±νŠΈλž˜ν‚Ήμ„ ν™œμš©ν•˜μ—¬ 문제λ₯Ό ν’€μ΄ν–ˆμŠ΅λ‹ˆλ‹€.

79. Word Search

Complexities πŸ“ˆ

  • Time Complexity: $O(N * M * 4^L)$ N,M = λ³΄λ“œμ˜ ν–‰κ³Ό μ—΄, L은 λ‹¨μ–΄μ˜ 길이
  • Space Complexity: $O(N*M)$ N,M = λ³΄λ“œμ˜ ν–‰κ³Ό μ—΄

Explanation πŸ“

첫 문자의 μœ„μΉ˜λ₯Ό νŒŒμ•…ν•œ λ’€ λ°±νŠΈλž˜ν‚Ήμ„ μ‚¬μš©ν•˜μ—¬ 경둜 탐색을 μ§„ν–‰ν–ˆμŠ΅λ‹ˆλ‹€.

208. Implement Trie (Prefix Tree)

Complexities πŸ“ˆ

  • Time Complexity: $O(N)$
  • Space Complexity: $O(N)$

Explanation πŸ“

@WhiteHyun WhiteHyun self-assigned this Jun 27, 2024
@WhiteHyun WhiteHyun marked this pull request as ready for review June 28, 2024 04:04
Copy link
Contributor

@yolophg yolophg left a comment

Choose a reason for hiding this comment

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

μƒμ„Έν•œ 정리 정말 λ°°μ›Œμ•Όκ² μŠ΅λ‹ˆλ‹€ πŸ‘
8주차도 차근히 λ‹€ ν‘Έμ…¨μœΌλ‹ˆ, 남은 9μ£Όμ°¨ ν‘Έμ‹œλ©΄μ„œ λ‹€μ‹œ motivation을 λΆˆμ–΄λ„£μ–΄λ³΄μ•„μš”!
수고 λ§ŽμœΌμ…¨μŠ΅λ‹ˆλ‹€ :)

@WhiteHyun WhiteHyun merged commit 8cf1244 into DaleStudy:main Jun 29, 2024
@WhiteHyun WhiteHyun deleted the whitehyun/week8 branch June 29, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants