Skip to content

[yuseok89] WEEK 04 Solutions#2739

Merged
yuseok89 merged 39 commits into
DaleStudy:mainfrom
yuseok89:main
Jul 18, 2026
Merged

[yuseok89] WEEK 04 Solutions#2739
yuseok89 merged 39 commits into
DaleStudy:mainfrom
yuseok89:main

Conversation

@yuseok89

@yuseok89 yuseok89 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

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

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

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

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

Important

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

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

@dalestudy

dalestudy Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

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

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

๋ฌธ์ œ ๋‚œ์ด๋„ ์œ ํ˜• ๋ถ„์„
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 413 43 456 $0.000038
2 1,855 219 2,074 $0.000180
3 1,859 206 2,065 $0.000175
4 1,913 194 2,107 $0.000173
5 1,897 284 2,181 $0.000208
6 1,900 217 2,117 $0.000182
ํ•ฉ๊ณ„ 9,837 1,163 11,000 $0.000957

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.

์ด๊ฑฐ 2๊ฐœ ๋น„๊ตํ•˜๋Š” ๋ถ€๋ถ„ ๋๋‚˜๊ณ  ๋ฆฌ์ŠคํŠธ ๋‘๊ฐœ์ค‘์— ํ•œ๊ฐœ ์ˆœํšŒ ๋‹ค ๋๋‚œ ์ƒํƒœ์—์„œ๋Š” ๋‚˜๋จธ์ง€ ๋‚จ์€ ๋ฆฌ์ŠคํŠธ๋Š” ๊ทธ๋ƒฅ ๋’ค์— ํ†ต์งธ๋กœ ๋ถ™ํ˜€์ฃผ๋Š”๊ฒŒ ๋” ์ข‹๋”๋ผ๊ตฌ์š”!
๊ทธ๋‹ˆ๊นŒ while ๋ง๊ตฌ ๋‹จ์ผ if๋ฌธ์œผ๋กœ ์ฒ˜๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•ด์„œ ์ด๊ฒŒ ํ›จ์”ฌ ๊น”๋”ํ•˜๊ณ  ์ข‹์€๊ฒƒ ๊ฐ™์•˜์–ด์š”
ํŒŒ์ด์ฌ์˜ or๊ฐ€ ์–ด๋–ป๊ฒŒ ๋‹จ์ถ•ํ‰๊ฐ€๋ฅผ ํ•˜๋Š”์ง€ ๊ณ ๋ คํ•˜๋ฉด ๋”์šฑ ์ค„์ผ์ˆ˜๋„ ์žˆ๊ตฌ์š”!

Comment thread coin-change/yuseok89.py

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.

์ €๋Š” ์ฝ”์ธ์ด ์–‘์ˆ˜๊ฐ’๋งŒ ์žˆ์–ด์„œ DP๋งŒ ํ–ˆ์—ˆ๋Š”๋ฐ BFS๋กœ ํ•ด๋„ ์ถฉ๋ถ„ํžˆ ๊ฐ€๋Šฅํ•˜๊ฒ ๋„ค์š”!

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.

์ €๋Š” while loop ์•ˆ์— ๋ณต์žกํ•œ ์—ฐ์‚ฐ ๋“ค์–ด๊ฐ€๋Š”๊ฑฐ ๋ณ„๋กœ๋ผ ์ตœ๋Œ€ํ•œ ๊ฐ„๋‹จํ•˜๊ฒŒ ํ–ˆ๋Š”๋ฐ, ์ด๋ ‡๊ฒŒ ํ•˜์‹œ๋ฉด ์–ผ๋ฆฌ ๋ฆฌํ„ด์ด ๊ฐ€๋Šฅํ•ด์„œ ์ข‹๋„ค์š”!

Comment thread word-search/yuseok89.py

@alphaorderly alphaorderly Jul 15, 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.

์ด๊ฑฐ ํšŒ์›๋‹˜ ๋‹ต์•ˆ์€ 3000ms ๊ฐ€๋Ÿ‰ ๊ฑธ๋ฆฌ๋Š”๋ฐ
๋ฐฑํŠธ๋ž˜ํ‚น์„ ์œ ์ง€ํ•œ ์ƒํƒœ์—์„œ

  1. ์–ด์ฐจํ”ผ ๋‹ต์ด ์•ˆ๋˜๋Š”๊ฒƒ ๋ฏธ๋ฆฌ ์ณ๋‚ด๊ธฐ
  2. ์ข€ ๋” ํšจ์œจ์ ์œผ๋กœ ํƒ์ƒ‰ํ•˜๊ธฐ

์ด ๋‘๊ฐ€์ง€๋งŒ ์ถ”๊ฐ€ํ•ด๋„ leetcode ์‹คํ–‰์†๋„์ƒ 0ms๊นŒ์ง€ ๋„๋‹ฌํ• ์ˆ˜ ์žˆ์–ด์š”!
๊ฝค๋‚˜ ํฅ๋ฏธ๋กญ๋”๋ผ๊ตฌ์š”, ์ €๋Š” ํ•˜๋‚˜ํ•˜๋‚˜ ์ง์ ‘ ์ถ”๊ฐ€ํ•ด๊ฐ€๋ฉด์„œ ์„ฑ๋Šฅ ํŠœ๋‹ ํ–ˆ์—ˆ๋„ค์š”

Comment thread word-search/yuseok89.py

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.

Image

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.

์•„์ฃผ ๊ฐœ์ธ์ ์ธ ์ƒ๊ฐ์ธ๋ฐ, rec์„ ์“ฐ์ง€ ์•Š๊ณ  maxDepth ์ž์ฒด๋ฅผ ์žฌ๊ท€๋กœ ํ•˜๋ฉด ์ข€ ์ฝ”๋“œ๊ฐ€ ๊ฐ„๋‹จํ•ด์ง€์ง€ ์•Š์„๊นŒ์š”?

Comment thread word-search/yuseok89.py

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 thread word-search/yuseok89.py

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.

๋งž์Šต๋‹ˆ๋‹ค! ๋นˆ๋„ ๊ธฐ๋ฐ˜์œผ๋กœ ๋’ค์ง‘์—ˆ๋Š”๋ฐ, ํ•ด๋‹น ๋ฌธ์ œ๋ฅผ ์–ด๋–ป๊ฒŒ ํ•˜๋ฉด ์กฐ๊ธˆ์ด๋ผ๋„ ๋นจ๋ฆฌ ํ’€์ˆ˜ ์žˆ์„๊นŒ์—๋งŒ ์ดˆ์ ์„ ๋งž์ถ˜ ์ฝ”๋“œ์ด๊ธด ํ•ฉ๋‹ˆ๋‹ค!

@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 thread find-minimum-in-rotated-sorted-array/yuseok89.py
Comment on lines +11 to +12
ret = ListNode()
cur = ret

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.

ret์€ ๋ฌด์Šจ ์•ฝ์ž์ผ๊นŒ์š”?

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.

return value ์•ฝ์ž๋กœ ์ผ๋Š”๋ฐ,
๋‹ค์Œ์—” ์ข€ ๋” ๊ฐ€๋…์„ฑ ์žˆ๊ฒŒ ์ž‘์„ฑํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

Comment thread word-search/yuseok89.py
Comment on lines +9 to +14
board_counter = Counter(board[r][c] for r in range(n) for c in range(m))
word_counter = Counter(word)

for c, cnt in word_counter.items():
if board_counter[c] < cnt:
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.

๋นˆ๋„ ์ด์šฉํ•ด์„œ ์ตœ์ ํ™”ํ•˜์‹  ๊ฑฐ ์ข‹์€ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ด๊ฑธ rec ํ•จ์ˆ˜์—์„œ๋„ ์‚ฌ์šฉํ•˜๋ฉด ์ข€ ๋” ์ตœ์ ํ™”๊ฐ€ ๊ฐ€๋Šฅํ•  ๊ฑฐ ๊ฐ™๋„ค์š”.

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.

rec ํ•จ์ˆ˜์—์„œ ์–ด๋–ป๊ฒŒ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ์„๊นŒ์š”?

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 thread word-search/yuseok89.py
Comment on lines +23 to +27
board[row][col] = None

ret = rec(row + 1, col, idx + 1) or rec(row - 1, col, idx + 1) or rec(row, col + 1, idx + 1) or rec(row, col - 1, idx + 1)

board[row][col] = word[idx]

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.

None์œผ๋กœ ํ• ๋‹นํ–ˆ๋‹ค๊ฐ€ word[idx]๋กœ ๋ณต์›ํ•˜๋Š”๊ฑฐ ์ข‹์€ ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค!

Comment thread coin-change/yuseok89.py

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.

bfs ๋ฐฉ์‹์œผ๋กœ ํ’€์–ด์ฃผ์…จ๋„ค์š”. dict ์ด์šฉํ•ด์„œ ํ•„์š”ํ•œ ๊ณต๊ฐ„๋งŒ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋„ ์‹ ๊ฒฝ์“ฐ์…”์„œ ํ‘ธ์‹  ๊ฑฐ ๊ฐ™๋„ค์š”.

Co-authored-by: Hojeong Park <parkhj062@gmail.com>
Comment thread coin-change/yuseok89.py

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.

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

  • ํŒจํ„ด: Breadth-First Search, Hash Map / Hash Set
  • ์„ค๋ช…: ์ฝ”์ธ ํ•ฉ์„ ๋ชฉํ‘œ ๊ธˆ์•ก์œผ๋กœ ๋„๋‹ฌํ•˜๋Š” ์ตœ๋‹จ ๊ฒฝ๋กœ๋ฅผ BFS๋กœ ํƒ์ƒ‰ํ•˜๊ณ , ๋ฐฉ๋ฌธ ์—ฌ๋ถ€๋ฅผ ํ•ด์‹œ ๋งต์œผ๋กœ ๊ด€๋ฆฌํ•˜์—ฌ ์ค‘๋ณต ๋ฐฉ๋ฌธ์„ ํ”ผํ•ฉ๋‹ˆ๋‹ค.

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

์œ ์ € ๋ถ„์„ ์‹ค์ œ ๋ถ„์„ ๊ฒฐ๊ณผ
Time O(amount * len(coins)) O(amount * len(coins)) โœ…
Space O(amount) O(amount) โœ…

ํ”ผ๋“œ๋ฐฑ: ํ๋ฅผ ์ด์šฉํ•ด ํ˜„์žฌ ํฌํ•จ๋œ ํ•ฉ์— ๋„๋‹ฌํ•œ ์ตœ์†Œ ๋™์ „ ์ˆ˜๋ฅผ ์—…๋ฐ์ดํŠธํ•œ๋‹ค. ๊ฐ ํ•ฉ์€ ํ•œ ๋ฒˆ๋งŒ ๋ฐฉ๋ฌธํ•˜๋ฏ€๋กœ ์ „์ฒด ์‹œ๊ฐ„์€ ๊ธˆ์•ก ๋ฒ”์œ„์™€ ๋™์ „ ์ข…๋ฅ˜์— ๋น„๋ก€ํ•œ๋‹ค.

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

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(logN) O(log n) โœ…
Space O(1) 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 ํŒจํ„ด์— ์†ํ•ฉ๋‹ˆ๋‹ค. ํŠธ๋ฆฌ์˜ ๊ตฌ์กฐ๋ฅผ ์ˆœํšŒํ•˜๋ฉฐ ์—ฐ๊ฒฐ๋œ ๋…ธ๋“œ ๋ฐฉ๋ฌธ์„ ๋ฐ˜๋ณตํ•˜๋Š” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.

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

์œ ์ € ๋ถ„์„ ์‹ค์ œ ๋ถ„์„ ๊ฒฐ๊ณผ
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
  • ์„ค๋ช…: ๋‘ ์—ฐ๊ฒฐ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ณ‘ํ•ฉํ•˜๊ธฐ ์œ„ํ•ด ๋‘ ํฌ์ธํ„ฐ(list1, list2)๋กœ ์›์†Œ๋ฅผ ์ฐจ๋ก€๋กœ ๋น„๊ตํ•˜๋ฉฐ ์ƒˆ๋กœ์šด ๋ฆฌ์ŠคํŠธ๋ฅผ ๋งŒ๋“ค์–ด๊ฐ€๋Š” ํŒจํ„ด์ž…๋‹ˆ๋‹ค. ์‹œ๊ฐ„ ๋ณต์žก๋„ O(N+M), ์ถ”๊ฐ€ ๊ณต๊ฐ„์€ ์ƒ์ˆ˜๋กœ ๊ตฌํ˜„๋ฉ๋‹ˆ๋‹ค.

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

์œ ์ € ๋ถ„์„ ์‹ค์ œ ๋ถ„์„ ๊ฒฐ๊ณผ
Time O(N+M) O(n + m) โœ…
Space O(1) O(1) โœ…

ํ”ผ๋“œ๋ฐฑ: ๋‘ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋™์‹œ์— ์ˆœํšŒํ•˜๋ฉฐ ๋” ์ž‘์€ ๋…ธ๋“œ๋ฅผ ์—ฐ๊ฒฐํ•œ๋‹ค.

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

Comment thread word-search/yuseok89.py

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, Backtracking
  • ์„ค๋ช…: ์ฝ”๋“œ๋Š” DFS๋ฅผ ์ด์šฉํ•ด 2D ๋ณด๋“œ์—์„œ ๋‹จ์–ด๋ฅผ ์ˆœ์„œ๋Œ€๋กœ ํƒ์ƒ‰ํ•˜๋ฉฐ, ๋ฐฉ๋ฌธํ•œ ์…€์„ ํ‘œ์‹œ ํ›„ ๋˜๋Œ๋ ค ๋†“๋Š” ๋ฐฑํŠธ๋ž˜ํ‚น ๋ฐฉ์‹์œผ๋กœ ๋ถ€๋ถ„ํ•ด๋ฅผ ์ฐพ๋Š”๋‹ค. ์‚ฌ์ „ ์กฐ๊ฑด ๊ฒ€์‚ฌ์™€ 4๋ฐฉํ–ฅ ํƒ์ƒ‰์ด ํ•ต์‹ฌ ํฌ์ธํŠธ์ด๋‹ค.

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

์œ ์ € ๋ถ„์„ ์‹ค์ œ ๋ถ„์„ ๊ฒฐ๊ณผ
Time O(NM4^L) O(ํ•ด๋‹น ๋ฌธ์ž์—ด์˜ ํƒ์ƒ‰ ๊ณต๊ฐ„) โŒ
Space O(L) O(n * m) โŒ

ํ”ผ๋“œ๋ฐฑ: ์ž…๋ ฅ ๊ธ€์ž ๋นˆ๋„ ๊ฒ€์‚ฌ๋ฅผ ๋จผ์ € ์ˆ˜ํ–‰ํ•ด ์‹คํŒจ๋ฅผ ์กฐ๊ธฐ์— ํ•ธ๋“ค๋งํ•œ๋‹ค. DFS๋กœ ์ธ์ ‘ ์นธ์„ ํƒ์ƒ‰ํ•œ๋‹ค.

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

@yuseok89
yuseok89 merged commit 1d03474 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.

4 participants