Skip to content

[JeonJe] WEEK 05 Solutions#2767

Merged
JeonJe merged 5 commits into
DaleStudy:mainfrom
JeonJe:week5
Jul 25, 2026
Merged

[JeonJe] WEEK 05 Solutions#2767
JeonJe merged 5 commits into
DaleStudy:mainfrom
JeonJe:week5

Conversation

@JeonJe

@JeonJe JeonJe commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

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

  • best-time-to-buy-and-sell-stock
  • group-anagrams
  • encode-and-decode-strings
  • implement-trie-prefix-tree
  • word-break

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

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

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

Important

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

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

@dalestudy

dalestudy Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

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

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

๋ฌธ์ œ ๋‚œ์ด๋„ ์œ ํ˜• ๋ถ„์„
best-time-to-buy-and-sell-stock Easy โœ… ์˜๋„ํ•œ ์œ ํ˜•
encode-and-decode-strings Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•
group-anagrams Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•
implement-trie-prefix-tree Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•
word-break Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•

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

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

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

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

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

๐Ÿ”ข API ์‚ฌ์šฉ๋Ÿ‰ (gpt-5-nano)
์š”์ฒญ ์ž…๋ ฅ ํ† ํฐ ์ถœ๋ ฅ ํ† ํฐ ํ•ฉ๊ณ„ ๋น„์šฉ
1 685 84 769 $0.000068
2 1,586 158 1,744 $0.000142
3 2,249 231 2,480 $0.000205
ํ•ฉ๊ณ„ 4,520 473 4,993 $0.000415

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.

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

  • ํŒจํ„ด: Greedy, Two Pointers
  • ์„ค๋ช…: ์ตœ์†Œ ๊ฐ€๊ฒฉ์„ ๋ˆ„์  ์ถ”์ ํ•˜๋ฉฐ ํ˜„์žฌ ๊ฐ€๊ฒฉ๊ณผ์˜ ์ฐจ์ด๋ฅผ ํ†ตํ•ด ๊ฐ€์žฅ ํฐ ์ด์ต์„ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ, ํ•œ ๋ฒˆ์˜ ์ˆœํšŒ๋กœ ์ตœ์  ํ•ด๋ฅผ ์–ป๋Š” ๊ทธ๋ฆฌ๋”” ํŒจํ„ด๊ณผ ๋ฌธ์ œ์˜ ์ธ๋ฑ์Šค ์ˆœ์„œ๋ฅผ ๋‘ ํฌ์ธํ„ฐ์ฒ˜๋Ÿผ ํ™œ์šฉํ•˜๋Š” ํ˜•ํƒœ๋ฅผ ๋ณด์ž…๋‹ˆ๋‹ค.

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

์œ ์ € ๋ถ„์„ ์‹ค์ œ ๋ถ„์„ ๊ฒฐ๊ณผ
Time O(n) O(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.

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

  • ํŒจํ„ด: Greedy, Hash Map / Hash Set
  • ์„ค๋ช…: ๋ฌธ์ž์—ด ์ธ์ฝ”๋”ฉ/๋””์ฝ”๋”ฉ ๋ฐฉ์‹์—์„œ ๊ธธ์ด์™€ ๊ตฌ๋ถ„์ž๋ฅผ ์ด์šฉํ•œ ์ˆœ์ฐจ์  ํŒŒ์‹ฑ์ด ํ•ต์‹ฌ์ด๋‹ค. ๋‹จ์ˆœํ•œ ํฌ๋งท์„ ๊ตฌ์„ฑํ•˜๊ณ  ์ด๋ฅผ ์žฌ๊ตฌ์„ฑํ•˜๋Š” ํ๋ฆ„์€ ํŒจํ„ด์ƒ Greedy(ํƒ์š•์ ์ด์ง„ ์•Š์ง€๋งŒ ์ง๊ด€์  ์ˆœ์ฐจ ์ฒ˜๋ฆฌ)์™€ ๋ฌธ์ž์—ด ์กฐ์ž‘/ํ•ด์‹œ ์—†์ด๋„ ๊ตฌํ˜„๋˜๋Š” ํŒจํ„ด์œผ๋กœ ๋ณผ ์ˆ˜ ์žˆ์œผ๋ฉฐ, ๋ฌธ์ž์—ด ๊ธธ์ด ์ •๋ณด๋ฅผ ์ด์šฉํ•ด ๊ตฌ๊ฐ„์„ ๋ถ„๋ฆฌํ•˜๋Š” ๋กœ์ง์ด ํ•ต์‹ฌ์ด๋‹ค.

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

โ„น๏ธ ์ด ํŒŒ์ผ์—๋Š” 2๊ฐ€์ง€ ํ’€์ด๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์–ด ๊ฐ๊ฐ ๋ถ„์„ํ•ฉ๋‹ˆ๋‹ค.

ํ’€์ด 1: Solution.encode โ€” Time: โŒ O(n) โ†’ O(total length of all strings) / Space: โŒ O(n) โ†’ O(total length of all strings)
์œ ์ € ๋ถ„์„ ์‹ค์ œ ๋ถ„์„ ๊ฒฐ๊ณผ
Time O(n) O(total length of all strings) โŒ
Space O(n) O(total length of all strings) โŒ

ํ”ผ๋“œ๋ฐฑ: ๊ธธ์ด ์ ‘๋‘์‚ฌ ๋ฐฉ์‹์œผ๋กœ ์ธ์ฝ”๋”ฉํ•˜์—ฌ ๊ตฌ๋ถ„์ž๋ฅผ ์ด์šฉํ•ด ๋””์ฝ”๋”ฉํ•œ๋‹ค.

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

ํ’€์ด 2: Solution.decode โ€” Time: O(total length of encoded string) / Space: O(number of strings + total length of strings)
๋ณต์žก๋„
Time O(total length of encoded string)
Space O(number of strings + total length of strings)

ํ”ผ๋“œ๋ฐฑ: ์ธ๋ฑ์Šค ๊ธฐ๋ฐ˜ ํŒŒ์‹ฑ์œผ๋กœ ์ •ํ™•ํ•œ ๋ณต์›์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

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

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

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.

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

  • ํŒจํ„ด: Hash Map / Hash Set, Sorting
  • ์„ค๋ช…: ๋ฌธ์ž์—ด์˜ ๊ฐ ๋ฌธ์ž์—ด์„ ๊ธ€์ž ์ •๋ ฌ ํ›„ ๊ฐ™์€ ์ •๋ ฌ ๊ฒฐ๊ณผ๋ฅผ ๊ฐ€์ง„ ๋ฌธ์ž์—ด๋“ค์„ hashmap์— ๋ชจ์•„ ๊ทธ๋ฃนํ™”ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๋™์ž‘ํ•œ๋‹ค. ํ•ด์‹œ๋งต์œผ๋กœ ํ‚ค(์ •๋ ฌ๋œ ๋ฌธ์ž์—ด)๋ณ„๋กœ ๊ฐ’(์›๋ž˜ ๋ฌธ์ž์—ด ๋ฆฌ์ŠคํŠธ)์„ ๋ชจ์œผ๋Š” ํŒจํ„ด์ด๋‹ค.

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

์œ ์ € ๋ถ„์„ ์‹ค์ œ ๋ถ„์„ ๊ฒฐ๊ณผ
Time O(n * k log k) O(n * k log k) โœ…
Space O(n * k) O(n + k) โŒ

ํ”ผ๋“œ๋ฐฑ: ์ •๋ ฌ๋œ ๋ฌธ์ž ๋ฐฐ์—ด์„ ํ•ด์‹œ๋งต ํ‚ค๋กœ ์‚ฌ์šฉํ•ด ์• ๋„ˆ๊ทธ๋žจ ๊ทธ๋ฃนํ™”๋ฅผ ๊ตฌํ˜„ํ•œ๋‹ค.

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

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.

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

  • ํŒจํ„ด: Trie
  • ์„ค๋ช…: ํŠธ๋ผ์ด(Trie) ์ž๋ฃŒ๊ตฌ์กฐ๋ฅผ ํ™œ์šฉํ•ด ๋‹จ์–ด์˜ ์ ‘๋‘์‚ฌ ๋งค์นญ์„ ๊ตฌํ˜„ํ•œ ์ฝ”๋“œ๋กœ, ๊ฐ ๋ฌธ์ž๋ณ„๋กœ ์ž์‹ ๋…ธ๋“œ๋ฅผ ๋”ฐ๋ผ๊ฐ€๋ฉฐ ํƒ์ƒ‰/์‚ฝ์ž…์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ ํŠธ๋ผ์ด ํŒจํ„ด์— ํ•ด๋‹นํ•ฉ๋‹ˆ๋‹ค.

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

๋ณต์žก๋„
Time O(L)
Space O(26 * number of nodes)

ํ”ผ๋“œ๋ฐฑ: ๋ฐฐ์—ด ๊ธฐ๋ฐ˜ ์ž์‹ ๋…ธ๋“œ์™€ ๋ ์—ฌ๋ถ€ ํ‘œ์‹œ๋กœ ๋น ๋ฅธ ๊ฒ€์ƒ‰์„ ์ œ๊ณตํ•œ๋‹ค.

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

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

Comment thread word-break/JeonJe.java

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, Two Pointers, Hash Map / Hash Set, Greedy
  • ์„ค๋ช…: ์ฃผ ์ฝ”๋“œ์—์„œ ํ•ต์‹ฌ์€ DP ๋ฐฐ์—ด๋กœ ๋ถ€๋ถ„ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋™์  ๊ณ„ํš๋ฒ•์ด๋ฉฐ, ๋’ค์—์„œ๋ถ€ํ„ฐ ์ฑ„์›Œ ์ „์ฒด ๊ตฌ๋ฌธ ๊ฐ€๋Šฅ ์—ฌ๋ถ€๋ฅผ ํŒ๋‹จํ•œ๋‹ค. ๋˜ํ•œ startsWith๋ฅผ ์ด์šฉํ•ด ๋ถ€๋ถ„ ๋ฌธ์ž์—ด์„ ๊ฒ€์‚ฌํ•˜๊ณ  ๋ถ€๋ถ„ ๋ฌธ์ œ๋ฅผ ์žฌ์‚ฌ์šฉํ•˜๋ฏ€๋กœ DP์˜ ์ „ํ˜•์  ํŒจํ„ด์ด ๋“œ๋Ÿฌ๋‚œ๋‹ค. ์ถ”๊ฐ€์ ์œผ๋กœ ์ฃผ์„์˜ top-down ์žฌ๊ท€ ์—ญ์‹œ ๋ฉ”๋ชจ์ด์ œ์ด์…˜์œผ๋กœ DP์˜ ๋‹ค๋ฅธ ๊ตฌํ˜„์„ ๋ณด์—ฌ์ค€๋‹ค.

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

์œ ์ € ๋ถ„์„ ์‹ค์ œ ๋ถ„์„ ๊ฒฐ๊ณผ
Time O(n * m * L) O(n * m) โŒ
Space O(n) O(n) โœ…

ํ”ผ๋“œ๋ฐฑ: ๋’ค์—์„œ ์•ž์œผ๋กœ dp๋ฅผ ์ฑ„์šฐ๋Š” ์ „ํ˜•์  ํ’€์ด๋กœ ์ถฉ๋ถ„ํ•˜๋‹ค.

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

@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 +11 to +14
for (int sellDay = 1; sellDay < n; sellDay++) {
minPrice = Math.min(minPrice, prices[sellDay]);
maxProfit = Math.max(maxProfit, prices[sellDay] - minPrice);
}

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.

sellDay ๋ณ€์ˆ˜๋ช… ์ง๊ด€์ ์ด์–ด์„œ ์ข‹์€ ๊ฑฐ ๊ฐ™๋„ค์š”

Comment thread word-break/JeonJe.java
Comment on lines +15 to +26
for (int i = n - 1; i >= 0; i--) {
for (String word : wordDict) {
// startsWith(word, i)๋Š” substring ์—†์ด i๋ฒˆ์งธ๋ถ€ํ„ฐ ๋น„๊ตํ•œ๋‹ค
if (s.startsWith(word, i) && dp[i + word.length()]) {
dp[i] = true;
break;
}
}
}

return dp[0];
}

@parkhojeong parkhojeong Jul 25, 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.

์•ž์—์„œ๋ถ€ํ„ฐ ๋ˆ„์ ํ•ด์„œ ํ‘ธ๋Š” ๋ถ„๋“ค์ด ๋งŽ์•˜๋Š”๋ฐ ๋ฐ˜๋Œ€๋กœ ํ‘ธ์…”์„œ ํฅ๋ฏธ๋กœ์› ์Šต๋‹ˆ๋‹ค. ์•ž์—์„œ๋ถ€ํ„ฐ ํ‘ธ๋Š” ๊ฒƒ๋„ ๊ณ ๋ คํ•˜์…จ์„ ๊ฑฐ ๊ฐ™์€๋ฐ ๋’ค์—์„œ๋ถ€ํ„ฐ ํ‘ธ์‹  ์ด์œ ๊ฐ€ ์žˆ์œผ์‹ค๊นŒ์š”?

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.

์žฌ๊ท€ ํ˜•์‹์˜ ํƒ‘๋‹ค์šด ๋ฐฉ์‹์œผ๋กœ ๋จผ์ € ํ’€๋‹ค๋ณด๋‹ˆ, ๋ฐ”ํ…€์—… ๋ฐฉ์‹๋„ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋’ค์—์„œ ์•ž ๋ฐฉํ–ฅ์œผ๋กœ ์ƒ๊ฐํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
๋‹ค๋ฅธ ๋ถ„๋“ค๊ป˜์„œ๋Š” ์–ด๋–ป๊ฒŒ ํ’€์ดํ•˜์…จ๋Š”์ง€ ํ•œ ๋ฒˆ ์‚ดํŽด๋ด์•ผ๊ฒ ๋„ค์š”.
๋ฆฌ๋ทฐ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!!

Comment on lines +20 to +23
if (node.children[c - 'a'] == null) {
node.children[c - 'a'] = new TrieNode();
}
node = node.children[c - 'a'];

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.

children[c - 'a'] ๋Š” TrieNode์˜ ์„ธ๋ถ€ ๊ตฌํ˜„์— ๊ฐ€๊นŒ์šด๋ฐ Trie์— c - 'a'๊ฐ€ ์—ฌ๋Ÿฌ ์ฝ”๋“œ์— ๊ฑธ์ณ ๋‚˜ํƒ€๋‚˜๊ณ  ์žˆ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. TrieNode์—์„œ node.getChildren(c) ์™€ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ ์ œ๊ณตํ•˜๋Š” ๊ฑด ์–ด๋–จ๊นŒ์š”?

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.

๋ฏธ์ฒ˜ ์ƒ๊ฐ ๋ชปํ–ˆ๋˜ ๋ถ€๋ถ„์ธ๋ฐ, ํ•จ์ˆ˜๋กœ ๊ฐ์‹ธ๋ฉด ๊ฐ€๋…์„ฑ๋„ ๋†’ํžˆ๊ณ  ์‹ค์ˆ˜๋„ ์ค„์ผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋„ค์š”.
๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!

@JeonJe
JeonJe merged commit bb77a5c into DaleStudy:main Jul 25, 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.

2 participants