Skip to content

[dolphinflow86] WEEK 04 Solutions#2741

Merged
dolphinflow86 merged 7 commits into
DaleStudy:mainfrom
dolphinflow86:main
Jul 18, 2026
Merged

[dolphinflow86] WEEK 04 Solutions#2741
dolphinflow86 merged 7 commits into
DaleStudy:mainfrom
dolphinflow86:main

Conversation

@dolphinflow86

@dolphinflow86 dolphinflow86 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

๋‹ต์•ˆ ์ œ์ถœ ๋ฌธ์ œ

์ž‘์„ฑ์ž ์ฒดํฌ ๋ฆฌ์ŠคํŠธ

  • Projects์˜ ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ(โ–ผ)์„ ๋ˆŒ๋Ÿฌ ํ™•์žฅํ•œ ๋’ค, Week๋ฅผ ํ˜„์žฌ ์ฃผ์ฐจ๋กœ ์„ค์ •ํ•ด์ฃผ์„ธ์š”.
  • ๋ฌธ์ œ๋ฅผ ๋ชจ๋‘ ํ‘ธ์‹œ๋ฉด ํ”„๋กœ์ ํŠธ์—์„œ Status๋ฅผ In Review๋กœ ์„ค์ •ํ•ด์ฃผ์„ธ์š”.
  • ์ฝ”๋“œ ๊ฒ€ํ† ์ž 1๋ถ„ ์ด์ƒ์œผ๋กœ๋ถ€ํ„ฐ ์Šน์ธ์„ ๋ฐ›์œผ์…จ๋‹ค๋ฉด PR์„ ๋ณ‘ํ•ฉํ•ด์ฃผ์„ธ์š”.

๊ฒ€ํ† ์ž ์ฒดํฌ ๋ฆฌ์ŠคํŠธ

Important

๋ณธ์ธ ๋‹ต์•ˆ ์ œ์ถœ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ๋‹ค๋ฅธ ๋ถ„ PR ํ•˜๋‚˜ ์ด์ƒ์„ ๋ฐ˜๋“œ์‹œ ๊ฒ€ํ† ๋ฅผ ํ•ด์ฃผ์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค!

  • ๋ฐ”๋กœ ์ด์ „์— ์˜ฌ๋ผ์˜จ PR์— ๋ณธ์ธ์„ ์ฝ”๋“œ ๋ฆฌ๋ทฐ์–ด๋กœ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.
  • ๋ณธ์ธ์ด ๊ฒ€ํ† ํ•ด์•ผํ•˜๋Š” PR์˜ ๋‹ต์•ˆ ์ฝ”๋“œ์— ํ”ผ๋“œ๋ฐฑ์„ ์ฃผ์„ธ์š”.
  • ํ† ์š”์ผ ์ „๊นŒ์ง€ PR์„ ๋ณ‘ํ•ฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์Šน์ธํ•ด์ฃผ์„ธ์š”.

@dalestudy

dalestudy Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

๐Ÿ“Š dolphinflow86 ๋‹˜์˜ ํ•™์Šต ํ˜„ํ™ฉ

์ด๋ฒˆ ์ฃผ ์ œ์ถœ ๋ฌธ์ œ

๋ฌธ์ œ ๋‚œ์ด๋„ ์œ ํ˜• ๋ถ„์„
coin-change Medium โš ๏ธ ์œ ํ˜• ๋ถˆ์ผ์น˜
find-minimum-in-rotated-sorted-array Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•
maximum-depth-of-binary-tree Easy โœ… ์˜๋„ํ•œ ์œ ํ˜•
merge-two-sorted-lists Easy โœ… ์˜๋„ํ•œ ์œ ํ˜•
word-search Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•

๋ˆ„์  ํ•™์Šต ์š”์•ฝ

  • ํ’€์ดํ•œ ๋ฌธ์ œ: 15 / 75๊ฐœ
  • ์ด๋ฒˆ ์ฃผ ์œ ํ˜• ์ผ์น˜์œจ: 80% (5๋ฌธ์ œ ์ค‘ 4๋ฌธ์ œ ์ผ์น˜)

๋ฌธ์ œ ํ’€์ด ํ˜„ํ™ฉ

์นดํ…Œ๊ณ ๋ฆฌ ์ง„ํ–‰๋„ ์™„๋ฃŒ
Array โ– โ– โ– โ– โ–กโ–กโ–ก 5 / 10 (Medium 3, Easy 2)
Dynamic Programming โ– โ– โ– โ–กโ–กโ–กโ–ก 4 / 11 (Easy 1, Medium 3)
Heap โ– โ– โ–กโ–กโ–กโ–กโ–ก 1 / 3 (Medium 1)
Binary โ– โ–กโ–กโ–กโ–กโ–กโ–ก 1 / 5 (Easy 1)
String โ– โ–กโ–กโ–กโ–กโ–กโ–ก 2 / 10 (Easy 2)
Graph โ– โ–กโ–กโ–กโ–กโ–กโ–ก 1 / 8 (Medium 1)
Tree โ– โ–กโ–กโ–กโ–กโ–กโ–ก 1 / 14 (Medium 1)
Interval โ–กโ–กโ–กโ–กโ–กโ–กโ–ก 0 / 5 โ† ์•„์ง ์‹œ์ž‘ ์•ˆ ํ•จ
Linked List โ–กโ–กโ–กโ–กโ–กโ–กโ–ก 0 / 6 โ† ์•„์ง ์‹œ์ž‘ ์•ˆ ํ•จ
Matrix โ–กโ–กโ–กโ–กโ–กโ–กโ–ก 0 / 4 โ† ์•„์ง ์‹œ์ž‘ ์•ˆ ํ•จ

๐Ÿค– ์ด ๋Œ“๊ธ€์€ GitHub App์„ ํ†ตํ•ด ์ž๋™์œผ๋กœ ์ž‘์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ”ข API ์‚ฌ์šฉ๋Ÿ‰ (gpt-5-nano)
์š”์ฒญ ์ž…๋ ฅ ํ† ํฐ ์ถœ๋ ฅ ํ† ํฐ ํ•ฉ๊ณ„ ๋น„์šฉ
1 418 47 465 $0.000040
2 848 79 927 $0.000074
3 1,237 159 1,396 $0.000125
4 1,850 169 2,019 $0.000160
5 1,845 183 2,028 $0.000165
6 1,852 165 2,017 $0.000159
7 2,296 224 2,520 $0.000204
ํ•ฉ๊ณ„ 10,346 1,026 11,372 $0.000928

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ํ˜น์‹œ pivot์„ (right + left) // 2 ๊ฐ€ ์•„๋‹Œ left + (right - left) // 2 ๋กœ ํ•˜์‹  ์ด์œ ๊ฐ€ ์žˆ์œผ์‹ค๊นŒ์š”?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

์ด๊ฑฐ depth ํŒจ๋Ÿฌ๋ฏธํ„ฐ ์ฃผ์ง€ ์•Š๊ณ  maxDepth ๋งŒ์œผ๋กœ๋„ ๊ตฌํ˜„ ๊ฐ€๋Šฅํ•˜์„ธ์š”! ์Šค์Šค๋กœ ์žฌ๊ท€ํ•ด์„œ ํ•˜๋ฉด ์ฝ”๋“œ๋„ ์—„์ฒญ ์ค„์ผ์ˆ˜ ์žˆ์–ด์š”, ์„ฑ๋Šฅ๋„ ๊ฐ™๊ณ ์š”

right = n-1

while left < right:
pivot = left + (right - left) // 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pivot = left + (right - left) // 2๋กœ ์˜ค๋ฒ„ํ”Œ๋กœ๋ฅผ ๋ฐฉ์–ดํ•˜์‹  ๋ถ€๋ถ„์ด ์ธ์ƒ๊นŠ์—ˆ์Šต๋‹ˆ๋‹ค!

ํ’€์ด๋ฅผ ๋ณด๊ณ  ๋ฌธ๋“ Python์—์„œ๋Š” ์˜ค๋ฒ„ํ”Œ๋กœ๊ฐ€ ์–ด๋–ป๊ฒŒ ๋˜๋Š”์ง€ ๊ถ๊ธˆํ•ด์ ธ์„œ ์ฐพ์•„๋ณด๋‹ˆ, Python์˜ int๋Š” ์ž„์˜์ •๋ฐ€๋„(arbitrary precision)๋ผ ๊ฐ’์ด ์•„๋ฌด๋ฆฌ ์ปค์ ธ๋„ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ๊ฐ€ ๋‚˜์ง€ ์•Š๋Š”๋‹ค๊ณ  ํ•˜๋”๋ผ๊ณ ์š”. ๊ทธ๋ž˜์„œ ์ด ๊ฒฝ์šฐ์—” (left + right) // 2๋กœ ๋‹จ์ˆœํ•˜๊ฒŒ ์จ๋„ ๊ดœ์ฐฎ์ง€ ์•Š์„๊นŒ ์‹ถ์€๋ฐ, ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?

๋ฐ˜๋Œ€๋กœ ์ €๋Š” Java์ธ๋ฐ๋„ ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ๋ฐฉ์–ด ์—†์ด (left + right) / 2๋กœ ํ’€์—ˆ๋”๋ผ๊ณ ์š” ๐Ÿ˜…

@alphaorderly alphaorderly Jul 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

์ด๊ฑฐ ๊ทผ๋ฐ

  • $$n == nums.length$$
  • $$1 \le n \le 5000$$

nums ๋ฐฐ์—ด ๊ธธ์ด๊ฐ€ ๊ธธ์–ด์•ผ 5,000์ด๋ผ์„œ
left + right ์˜ ์ตœ๋Œ€ ๊ฐ’์ด 10,000์ด๋ผ์„œ์š”
์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ์• ์ดˆ์— ์‹ ๊ฒฝ ์•ˆ์จ๋„ ๋ ๊ฑฐ์—์š”

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

๋‘ ๋ถ„ ๋‹ค ์ข‹์€ ์ฝ”๋ฉ˜ํŠธ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!

์ œ๊ฐ€ ์˜ˆ์ „์—๋Š” c++๋กœ ์ฃผ๋กœ ํ’€์—ˆ๋‹ค๋ณด๋‹ˆ ์Šต๊ด€์ ์œผ๋กœ ์ €๋ ‡๊ฒŒ ์ผ๋˜ ๊ฒƒ ๊ฐ™์•„์š”.
๋ฌธ์ œ ์กฐ๊ฑด ์ƒ ์ €๋ ‡๊ฒŒ ์•ˆํ•ด๋„ ๋˜๊ฒ ๋„ค์š”!
๊ทธ๋ฆฌ๊ณ  ํŒŒ์ด์ฌ์€ int๊ฐ€ ์ž„์˜์ •๋ฐ€๋„๋ผ๋Š” ์‚ฌ์‹ค ์ƒˆ๋กœ ์•Œ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค :)

@alphaorderly alphaorderly Jul 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

์ƒ๊ฐ๋‚˜์„œ ํ•˜๋‚˜ ๋ง๋ถ™ํžˆ์ž๋ฉด ๋ณดํ†ต ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ์ผ์–ด๋‚˜์„œ ๊ด€๋ฆฌํ•ด์•ผ ํ•˜๋Š” ๋ฌธ์ œ๋“ค์€ 10^9 + 7 ๋กœ ๋‚˜๋จธ์ง€์—ฐ์‚ฐ ํ•ด์„œ ๋ฆฌํ„ดํ•˜๋ผ๊ณ  ํ•˜๋”๋ผ๊ณ ์š”!

@parkhojeong parkhojeong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค. ๋ช‡๊ฐ€์ง€ ์ปค๋ฉ˜ํŠธ ๋‚จ๊ฒจ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

Comment on lines +15 to +18
if nums[pivot] < nums[right]:
right = pivot
else:
left = pivot + 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

์ข€๋” ์ตœ์ ํ™” ํ•œ๋‹ค๋ฉด ์ด ๋กœ์ง์„ ์ถ”๊ฐ€ํ•ด๋ณผ ์ˆ˜ ์žˆ์„ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค.

if nums[left] < nums[pivot] < nums[right]:
                return nums[left]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@parkhojeong ์˜ค.. ์ƒ๊ฐํ•˜์ง€ ๋ชปํ–ˆ๋Š”๋ฐ ์ข‹์€ ์ตœ์ ํ™” ํฌ์ธํŠธ๋„ค์š”!
์•Œ๋ ค์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

else:
left = pivot + 1

return nums[right]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: right ๋ณด๋‹จ left๊ฐ€ ์•ฝ๊ฐ„ ๋” ์ž์—ฐ์Šค๋Ÿฌ์šด(?) ๊ฐœ์ธ์ ์ธ ๋А๋‚Œ์ด ์žˆ๋Š” ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Suggested change
return nums[right]
return nums[left]

Comment thread word-search/dolphinflow86.py Outdated
Comment on lines +30 to +33
n = len(board)
m = len(board[0])
w = len(word)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

n, m, w ๋ณด๋‹จ ์˜๋ฏธ ์žˆ๋Š” ๋„ค์ด๋ฐ ์‚ฌ์šฉํ•˜๋Š”๊ฒŒ ์ธ์ง€ ๋ถ€ํ•˜๋ฅผ ์ค„์—ฌ์ค„ ์ˆ˜ ์žˆ์„ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Comment thread word-search/dolphinflow86.py Outdated
Comment on lines +34 to +35
# Early return if the board contains fewer cells than the word length.
if n * m < w: return False

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

๊ผผ๊ผผํ•˜๊ฒŒ ์ตœ์ ํ™” ํ•ด์ฃผ์…จ๋„ค์š”.


curr.next = list1 if list1 else list2

return dummy.next

@parkhojeong parkhojeong Jul 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dummy ๋„ ๊ดœ์ฐฎ์€๋ฐ ์˜๋ฏธ๋ฅผ ์กฐ๊ธˆ ๋” ๋‹ด์€ ๋„ค์ด๋ฐ์ด๋ฉด ์–ด๋–จ๊นŒ ์‹ถ์Šต๋‹ˆ๋‹ค.

Comment thread maximum-depth-of-binary-tree/dolphinflow86.py Outdated
Comment on lines +13 to +14
while left < right:
pivot = left + (right - left) // 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

์‹ค์งˆ์ ์œผ๋กœ left, right์˜ ์ค‘๊ฐ„์— ํ•ด๋‹นํ•˜๋Š” mid ๊ฐ’์ด ๋“ค์–ด๊ฐ€์„œ mid ๊ฐ™์€ ๋ณ€์ˆ˜๋ช…์„ ์“ฐ๋Š”๊ฒŒ ์–ด๋–จ๊นŒ ์‹ถ์Šต๋‹ˆ๋‹ค. ์ดํ›„ ์—ญํ• ๋กœ์„œ pivot์œผ๋กœ ์‚ฌ์šฉํ•˜๋Š” ๊ฑฐ๋ผ์„œ์š”.

dolphinflow86 and others added 2 commits July 17, 2026 23:22
์˜ค ๋„ต ์ด๊ฒŒ ๋‚ซ๊ฒ ๋„ค์š”! ๋ณ€์ˆ˜๋ฅผ ์“ด๋‹ค๋ฉด ๋” ๋ช…์‹œ์ ์œผ๋กœ ์ ์–ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

Co-authored-by: Hojeong Park <parkhj062@gmail.com>

@dahyeong-yun dahyeong-yun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ํ•œ ์ฃผ๊ฐ„ ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค! ๋‹ค๋ฅธ ๋ถ„๋“ค๋„ ๋งŽ์ด ๋ฆฌ๋ทฐ๋ฅผ ํ•ด์ฃผ์…จ๋„ค์š”. ์ฝ”๋“œ๋„ ๊ฐ„๊ฒฐํ•˜๊ณ , ์ €๋„ ๋น„์Šทํ•œ ๋ฐฉ์‹์œผ๋กœ ํ’€์—ˆ์–ด์„œ ํฌ๊ฒŒ ์ฝ”๋ฉ˜ํŠธ ๋“œ๋ฆด ๋ถ€๋ถ„์€ ์—†๋Š” ๊ฒƒ ๊ฐ™์•„์š” :)

์ €๋Š” ์ด๋ฒˆ ์ฃผ word-search ๊ณผ ๊ฐ™์ด ๋ฐฑํŠธ๋ž˜ํ‚น ํ•ด์•ผ ํ•˜๋Š” ๋ถ€๋ถ„์ด ํ•ญ์ƒ ์ข€ ์‰ฝ๊ฒŒ ์•ˆ ๋– ์˜ค๋ฅด๊ณ  ์•ˆ ํ’€๋ฆฌ๋”๋ผ๊ณ ์š”. dolphinflow86 ๋‹˜์€ ํ’€๋ฉด์„œ ๋‹ค๋ฅธ ์–ด๋ ค์›€์€ ์—†์œผ์…จ๋Š”์ง€ ๊ถ๊ธˆํ•˜๋„ค์š”. ๋‹ค์Œ ์ฃผ๋„ ํ™”์ดํŒ… ํ•ด๋ด์š”~!

return True

temp = board[row][col]
board[row][col] = '#'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

์ถ”๊ฐ€ ๊ณต๊ฐ„ ์—†์ด ์ž„์‹œ๋ฌธ์ž๋กœ ๋Œ€์ฒด ํ–ˆ๋‹ค๊ฐ€ ๋ณต๊ตฌํ•˜๋Š” ๊ฒƒ๋„ ์ข‹์€ ๋ฐฉ๋ฒ•์ด๋„ค์š” ๐Ÿ‘๐Ÿผ

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

์‹ค์ œ๋กœ ๋Œ๋ ค๋ณด๋‹ˆ 4000ms ์ •๋„ ๋‚˜์˜ค๋Š”๋ฐ ์กฐ๊ธˆ ๋” ์ตœ์ ํ™” ํ•ด๋ณด์…”๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

๐Ÿท๏ธ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํŒจํ„ด ๋ถ„์„

  • ํŒจํ„ด: Dynamic Programming, Backtracking, Hash Map / Hash Set
  • ์„ค๋ช…: ์ฝ”์ธ ๊ตํ™˜ ๋ฌธ์ œ์—์„œ ๊ฐ ๋‚จ์€ ๊ธˆ์•ก์— ๋Œ€ํ•ด ์ตœ์†Ÿ๊ฐ’์„ ๊ตฌํ•˜๊ธฐ ์œ„ํ•ด ์žฌ๊ท€๋กœ ํƒ์ƒ‰ํ•˜๊ณ , ๊ฒฐ๊ณผ๋ฅผ ๋ฉ”๋ชจ์ด์ œ์ด์…˜(memo)ํ•˜์—ฌ ์ค‘๋ณต ํƒ์ƒ‰์„ ์ค„์ด๋Š” ํŒจํ„ด์ด๋‹ค. ๋˜ํ•œ ๋ชจ๋“  ์ฝ”์ธ ์กฐํ•ฉ์„ ์‹œ๋„ํ•˜๋Š” ํ˜•ํƒœ์ด๋ฏ€๋กœ ๋ฐฑํŠธ๋ž˜ํ‚น์˜ ํŠน์ง•๋„ ํฌํ•จ๋˜๋ฉฐ, DP์˜ ์žฌ๊ท€์  ๊ตฌํ˜„์ธ ํƒ‘๋‹ค์šด ๋ฐฉ์‹์ด๋‹ค.

๐Ÿ“Š ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„ ๋ถ„์„

๋ณต์žก๋„
Time O(amount * len(coins))
Space O(amount)

ํ”ผ๋“œ๋ฐฑ: ์ƒํ–ฅ์‹์ด ์•„๋‹Œ ํƒ‘๋‹ค์šด ๋ฐฉ์‹์œผ๋กœ ์ค‘๋ณต ์„œ๋ธŒ๋ฌธ์ œ ๊ณ„์‚ฐ์„ ์ค„์ธ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ตœ์•…์˜ ๊ฒฝ์šฐ ๊ฐ ๋‚จ์€ ๊ธˆ์•ก์— ๋Œ€ํ•ด ๋ชจ๋“  ๋™์ „์„ ์‹œ๋„ํ•˜๋ฏ€๋กœ O(amount * len(coins))์˜ ์‹œ๊ฐ„๋ณต์žก๋„๊ฐ€ ๋œ๋‹ค.

๊ฐœ์„  ์ œ์•ˆ: ํ˜„์žฌ ๊ตฌํ˜„์ด ์ ์ ˆํ•ด ๋ณด์ž…๋‹ˆ๋‹ค.

๐Ÿ’ก ํ’€์ด์— ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„๋ฅผ ์ฃผ์„์œผ๋กœ ๋‚จ๊ฒจ๋ณด์„ธ์š”!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

๐Ÿท๏ธ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํŒจํ„ด ๋ถ„์„

  • ํŒจํ„ด: Binary Search
  • ์„ค๋ช…: ๋ฐฐ์—ด์„ ์ด์ง„ ํƒ์ƒ‰์œผ๋กœ ์ ˆ๋ฐ˜์œผ๋กœ ์ค„์ด๋ฉฐ ํšŒ์ „๋œ ์ •๋ ฌ ๋ฐฐ์—ด์—์„œ ์ตœ์†Ÿ๊ฐ’์˜ ์œ„์น˜๋ฅผ ์ฐพ๋Š”๋‹ค. ๊ฐ ์ˆœํ™˜์—์„œ ์ค‘๊ฐ„ ๊ฐ’๊ณผ ๋ ๊ฐ’์„ ๋น„๊ตํ•ด ์ขŒ์ธก ๋˜๋Š” ์šฐ์ธก ๊ตฌ๊ฐ„์œผ๋กœ ๋ฒ”์œ„๋ฅผ ์ถ•์†Œํ•œ๋‹ค.

๐Ÿ“Š ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„ ๋ถ„์„

๋ณต์žก๋„
Time O(log n)
Space O(1)

ํ”ผ๋“œ๋ฐฑ: ๊ตฌํ˜„์€ ํ™”์‚ดํ‘œ์˜ ์ง„ํ–‰ ๋ฐฉํ–ฅ์„ ๊ฒฐ์ •ํ•˜๋Š” ๋น„๊ต๋กœ ์™ผ์ชฝ/์˜ค๋ฅธ์ชฝ์˜ ์ ˆ๋Œ“๊ฐ’ ๊ตฌ๊ฐ„์„ ๋ฐ˜์œผ๋กœ ๋‚˜๋ˆ  ํƒ์ƒ‰ํ•œ๋‹ค.

๊ฐœ์„  ์ œ์•ˆ: ํ˜„์žฌ ๊ตฌํ˜„์ด ์ ์ ˆํ•ด ๋ณด์ž…๋‹ˆ๋‹ค.

๐Ÿ’ก ํ’€์ด์— ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„๋ฅผ ์ฃผ์„์œผ๋กœ ๋‚จ๊ฒจ๋ณด์„ธ์š”!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

๐Ÿท๏ธ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํŒจํ„ด ๋ถ„์„

  • ํŒจํ„ด: Depth-First Search, Binary Search
  • ์„ค๋ช…: ์ฃผ์š” ๋กœ์ง์ด DFS๋กœ ํŠธ๋ฆฌ๋ฅผ ๊นŠ์ด ์šฐ์„  ์ˆœํšŒํ•˜๋ฉฐ ๊ฐ ๊ฐ€์ง€์˜ ๊นŠ์ด๋ฅผ ํƒ์ƒ‰ํ•˜๊ณ  ์ตœ๋Œ“๊ฐ’์„ ๋ฐ˜ํ™˜ํ•˜๊ธฐ ๋•Œ๋ฌธ์— DFS ํŒจํ„ด์— ํ•ด๋‹นํ•ฉ๋‹ˆ๋‹ค. ํŠธ๋ฆฌ์˜ ํƒ์ƒ‰๊ณผ ๊นŠ์ด ๊ด€๋ฆฌ๋กœ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ“Š ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„ ๋ถ„์„

์œ ์ € ๋ถ„์„ ์‹ค์ œ ๋ถ„์„ ๊ฒฐ๊ณผ
Time O(N) O(n) โœ…
Space O(H) O(h) โœ…

ํ”ผ๋“œ๋ฐฑ: ๋ฆฌํ”„๊นŒ์ง€ ๋ฐฉ๋ฌธํ•ด์•ผ ํ•˜๋ฏ€๋กœ ๋…ธ๋“œ ์ˆ˜์— ๋น„๋ก€ํ•˜๋Š” ์‹œ๊ฐ„๊ณผ ์žฌ๊ท€ ํ˜ธ์ถœ ์Šคํƒ์˜ ์ตœ๋Œ€ ๊นŠ์ด๋ฅผ ๊ณต๊ฐ„๋ณต์žก๋„๋กœ ๊ฐ€์ง„๋‹ค.

๊ฐœ์„  ์ œ์•ˆ: ํ˜„์žฌ ๊ตฌํ˜„์ด ์ ์ ˆํ•ด ๋ณด์ž…๋‹ˆ๋‹ค.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

๐Ÿท๏ธ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํŒจํ„ด ๋ถ„์„

  • ํŒจํ„ด: Two Pointers, Merge Sort (not listed), Linked List
  • ์„ค๋ช…: ๋‘ ํฌ์ธํ„ฐ๋ฅผ ์‚ฌ์šฉํ•ด ๋‘ ์—ฐ๊ฒฐ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ณ‘ํ•ฉํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ, ์ž‘์€ ๊ฐ’์˜ ๋…ธ๋“œ๋ฅผ ์ฐจ๋ก€๋กœ ์„ ํƒํ•ด ์ƒˆ ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค. ๋ฆฌ์ŠคํŠธ๋ฅผ ์ˆœํšŒํ•˜๋ฉฐ ํ•œ์ชฝ์ด ๋๋‚˜๋ฉด ๋‚˜๋จธ์ง€๋ฅผ ์—ฐ๊ฒฐํ•˜๊ณ  ์‹œ๊ฐ„ ๋ณต์žก๋„๋Š” O(N+M)์ž…๋‹ˆ๋‹ค.

๐Ÿ“Š ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„ ๋ถ„์„

๋ณต์žก๋„
Time O(m + n)
Space O(1)

ํ”ผ๋“œ๋ฐฑ: ๋‘ ์—ฐ๊ฒฐ ๋ฆฌ์ŠคํŠธ๋ฅผ ์ˆœ์ฐจ์ ์œผ๋กœ ๋ณ‘ํ•ฉํ•˜๋ฉฐ, ์ถ”๊ฐ€์ ์ธ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น ์—†์ด ๋…ธ๋“œ ์—ฐ๊ฒฐ๋งŒ ์ˆ˜ํ–‰ํ•œ๋‹ค.

๊ฐœ์„  ์ œ์•ˆ: ํ˜„์žฌ ๊ตฌํ˜„์ด ์ ์ ˆํ•ด ๋ณด์ž…๋‹ˆ๋‹ค.

๐Ÿ’ก ํ’€์ด์— ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„๋ฅผ ์ฃผ์„์œผ๋กœ ๋‚จ๊ฒจ๋ณด์„ธ์š”!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

๐Ÿท๏ธ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ํŒจํ„ด ๋ถ„์„

  • ํŒจํ„ด: Backtracking, Depth-First Search
  • ์„ค๋ช…: ๋ฐฑํŠธ๋ž˜ํ‚น์œผ๋กœ DFS๋ฅผ ์ด์šฉํ•ด ๋ณด๋“œ์—์„œ ๋‹จ์–ด๋ฅผ ์ฐพ๋Š” ๊ตฌ์กฐ์ด๋ฉฐ, ์ธ์ ‘ํ•œ ์นธ์„ ์ˆœํšŒํ•˜๋ฉฐ ๋งž๋Š”์ง€ ์žฌ๊ท€์ ์œผ๋กœ ์‹œ๋„ํ•˜๊ณ  ๋˜๋Œ๋ฆฌ๋Š” ๋ฐฉ์‹์ด ํ•ต์‹ฌ์ด๋‹ค.

๐Ÿ“Š ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„ ๋ถ„์„

๋ณต์žก๋„
Time O(N * 4^L)
Space O(L)

ํ”ผ๋“œ๋ฐฑ: ๋ฐฉ๋ฌธ ์ฒดํฌ๋ฅผ ์œ„ํ•ด ์žฌ๋ฃฐ ํƒ์ƒ‰๊ณผ ์žฌํƒ์ƒ‰์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์œผ๋ฏ€๋กœ ์ตœ์•…์˜ ๊ฒฝ์šฐ ์ง€์ˆ˜์ ์ผ ์ˆ˜ ์žˆ๋‹ค.

๊ฐœ์„  ์ œ์•ˆ: ํ˜„์žฌ ๊ตฌํ˜„์ด ์ ์ ˆํ•ด ๋ณด์ž…๋‹ˆ๋‹ค.

๐Ÿ’ก ํ’€์ด์— ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„๋ฅผ ์ฃผ์„์œผ๋กœ ๋‚จ๊ฒจ๋ณด์„ธ์š”!

@dolphinflow86

Copy link
Copy Markdown
Contributor Author

ํ•œ ์ฃผ๊ฐ„ ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค! ๋‹ค๋ฅธ ๋ถ„๋“ค๋„ ๋งŽ์ด ๋ฆฌ๋ทฐ๋ฅผ ํ•ด์ฃผ์…จ๋„ค์š”. ์ฝ”๋“œ๋„ ๊ฐ„๊ฒฐํ•˜๊ณ , ์ €๋„ ๋น„์Šทํ•œ ๋ฐฉ์‹์œผ๋กœ ํ’€์—ˆ์–ด์„œ ํฌ๊ฒŒ ์ฝ”๋ฉ˜ํŠธ ๋“œ๋ฆด ๋ถ€๋ถ„์€ ์—†๋Š” ๊ฒƒ ๊ฐ™์•„์š” :)

์ €๋Š” ์ด๋ฒˆ ์ฃผ word-search ๊ณผ ๊ฐ™์ด ๋ฐฑํŠธ๋ž˜ํ‚น ํ•ด์•ผ ํ•˜๋Š” ๋ถ€๋ถ„์ด ํ•ญ์ƒ ์ข€ ์‰ฝ๊ฒŒ ์•ˆ ๋– ์˜ค๋ฅด๊ณ  ์•ˆ ํ’€๋ฆฌ๋”๋ผ๊ณ ์š”. dolphinflow86 ๋‹˜์€ ํ’€๋ฉด์„œ ๋‹ค๋ฅธ ์–ด๋ ค์›€์€ ์—†์œผ์…จ๋Š”์ง€ ๊ถ๊ธˆํ•˜๋„ค์š”. ๋‹ค์Œ ์ฃผ๋„ ํ™”์ดํŒ… ํ•ด๋ด์š”~!

์ฝ”๋ฉ˜ํŠธ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค! ์ €๋„ ๋ฐฑํŠธ๋ž˜ํ‚น ํ•˜๋Š”๊ฑฐ๋ž‘, top down DP๋ž‘ ๊ฐ€๋”์‹ ํ˜ผ๋™์ด ์˜ค๋”๋ผ๊ณ ์š”, ๋น„์Šทํ•œ ๋ฌธ์ œ๋ฅผ ๊ณ„์† ํ’€์–ด๋ณด๋ฉด ์–ด๋А์ˆœ๊ฐ„ ํŒจํ„ด์ด ์ข€ ๋ณด์ด์ง€ ์•Š์„๊นŒ ํ•ฉ๋‹ˆ๋‹ค. ํ•œ ์ฃผ๊ฐ„ ๊ณ ์ƒ ๋งŽ์œผ์…จ๊ณ  ๊ฐ™์ด ํ™”์ดํŒ… ํ•˜์‹œ์ฃ !

@dolphinflow86
dolphinflow86 merged commit 0ca4e18 into DaleStudy:main Jul 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

6 participants