Skip to content

[seongmin36] WEEK 03 Solutions#2715

Open
seongmin36 wants to merge 5 commits into
DaleStudy:mainfrom
seongmin36:week3-solutions
Open

[seongmin36] WEEK 03 Solutions#2715
seongmin36 wants to merge 5 commits into
DaleStudy:mainfrom
seongmin36:week3-solutions

Conversation

@seongmin36

@seongmin36 seongmin36 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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

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

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

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

Important

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

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

@dalestudy

dalestudy Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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

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

๋ฌธ์ œ ๋‚œ์ด๋„ ์œ ํ˜• ๋ถ„์„
combination-sum Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•
decode-ways Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•
maximum-subarray Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•
number-of-1-bits Easy โš ๏ธ ์œ ํ˜• ๋ถˆ์ผ์น˜
valid-palindrome Easy โœ… ์˜๋„ํ•œ ์œ ํ˜•

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

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

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

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

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

๐Ÿ”ข API ์‚ฌ์šฉ๋Ÿ‰ (gpt-5-nano)
์š”์ฒญ ์ž…๋ ฅ ํ† ํฐ ์ถœ๋ ฅ ํ† ํฐ ํ•ฉ๊ณ„ ๋น„์šฉ
1 794 122 916 $0.000089
2 2,399 238 2,637 $0.000215
ํ•ฉ๊ณ„ 3,193 360 3,553 $0.000304

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
  • ์„ค๋ช…: ์ •๋ ฌ๋œ ํ›„๋ณด๋ฅผ ์ˆœ์ฐจ์ ์œผ๋กœ ํƒ์ƒ‰ํ•˜๋ฉฐ ๋‚จ์€ ํ•ฉ์„ ์ค„์—ฌ๊ฐ€๊ณ , ์กฐ๊ฑด์ด ๋งž์œผ๋ฉด ๋ถ€๋ถ„ํ•ด๋ฅผ ๊ฒฐ๊ณผ์— ์ถ”๊ฐ€ํ•˜๋Š” ์žฌ๊ท€ ํƒ์ƒ‰ ๋ฐฉ์‹์œผ๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์–ด Backtracking ํŒจํ„ด์— ํ•ด๋‹นํ•ฉ๋‹ˆ๋‹ค.

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

๋ณต์žก๋„
Time O(k * n)
Space O(n)

ํ”ผ๋“œ๋ฐฑ: ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌ ํ›„ ๊ฐ™์€ ์›์†Œ๋ฅผ ์—ฌ๋Ÿฌ ๋ฒˆ ์žฌ์‚ฌ์šฉํ•˜๋Š” ๋ฐฑํŠธ๋ž˜ํ‚น ๋ฐฉ์‹์œผ๋กœ ํ•ด๋ฅผ ์ฐพ์œผ๋ฉฐ ๊ฐ€์ง€์น˜๊ธฐ๋ฅผ ํ†ตํ•ด ๋ถˆํ•„์š”ํ•œ ๊ฒฝ๋กœ๋ฅผ ์ค„์ธ๋‹ค.

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

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

Comment thread decode-ways/seongmin36.js

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
  • ์„ค๋ช…: ์ฃผ์–ด์ง„ ์ฝ”๋“œ๋Š” ๋ฌธ์ž์—ด ๋ถ„ํ• ์˜ ๊ฒฝ์šฐ์˜ ์ˆ˜๋ฅผ DP๋กœ ๊ณ„์‚ฐํ•œ๋‹ค. ์ด 2์ž๋ฆฌ ๋˜๋Š” 1์ž๋ฆฌ ํ•ด์„ ๊ฐ€๋Šฅ ์—ฌ๋ถ€๋ฅผ ์ ์ง„์ ์œผ๋กœ ๋ˆ„์ ํ•ด ๋น„์šฉ์„ ํ•ฉ์‚ฐํ•˜๋Š” ๋ฐ”ํ…€์—… DP ํŒจํ„ด์ด ํ•ต์‹ฌ์ด๋‹ค. Two Pointers๋‚˜ Hash Map๋ณด๋‹ค๋Š” DP์˜ ์ค‘์š” ํŒจํ„ด์ด ๊ฐ€์žฅ ๋‘๋“œ๋Ÿฌ์ง„๋‹ค.

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

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

ํ”ผ๋“œ๋ฐฑ: ๋‘ ์ž๋ฆฌ ์ˆซ์ž ๊ฐ€๋Šฅ ์—ฌ๋ถ€๋ฅผ isAlphabet๋กœ ํŒ๋‹จํ•˜๊ณ  dp ๋ฐฐ์—ด์— ๋ˆ„์ ํ•ด ๊ฒฝ์šฐ์˜ ์ˆ˜๋ฅผ ํ•ฉ์‚ฐํ•œ๋‹ค.

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

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

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, Dynamic Programming
  • ์„ค๋ช…: ์ฝ”๋“œ๋Š” Kadane์˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜์œผ๋กœ ์—ฐ์† ๋ถ€๋ถ„ ๋ฐฐ์—ด์˜ ํ•ฉ์˜ ์ตœ๋Œ“๊ฐ’์„ ๊ตฌํ•œ๋‹ค. ํ˜„์žฌ ํ•ฉ์ด ์Œ์ˆ˜๋ฉด ์ƒˆ๋กœ์šด ์‹œ์ž‘์ ์„ ์„ ํƒํ•˜๊ณ , ์–‘์ˆ˜๋ฉด ๊ณ„์† ํ™•์žฅํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ตœ์ ํ•ด๋ฅผ ์–ป๋Š”๋‹ค. ๋”ฐ๋ผ์„œ Greedy์™€ DP์˜ ์•„์ด๋””์–ด๋ฅผ ๋ชจ๋‘ ํฌํ•จํ•˜๋Š” ๋Œ€ํ‘œ์  ํŒจํ„ด์ด๋‹ค.

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

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

ํ”ผ๋“œ๋ฐฑ: cur_sum๊ณผ result๋ฅผ ์œ ์ง€ํ•˜๋ฉฐ ์Œ์ˆ˜ ๊ตฌ๊ฐ„์„ ๋Š๊ณ  ์ตœ๋Œ€๊ฐ’์„ ๊ฐฑ์‹ ํ•œ๋‹ค.

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

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

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.

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

  • ํŒจํ„ด: Bit Manipulation, Greedy
  • ์„ค๋ช…: ๋น„ํŠธ ์—ฐ์‚ฐ์œผ๋กœ 1๋น„ํŠธ๋ฅผ ๊ฒ€์‚ฌํ•˜๊ณ  ์šฐ์ธก์œผ๋กœ ์‹œํ”„ํŠธํ•˜๋ฉฐ ์ˆœ์ฐจ์ ์œผ๋กœ ์นด์šดํŠธํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ตœ์ ํ™”๋œ ๋น„ํŠธ ์กฐ์ž‘ ํ’€์ด์ด๋‹ค. ๋ง๋ถ™์—ฌ ์ˆซ์ž๋ฅผ ์ด์ง„์ˆ˜๋กœ ๋ณ€ํ™˜ํ•˜์ง€ ์•Š๊ณ ๋„ 1์˜ ๊ฐœ์ˆ˜๋ฅผ ๊ตฌํ•œ๋‹ค.

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

๋ณต์žก๋„
Time O(number of bits)
Space O(1)

ํ”ผ๋“œ๋ฐฑ: n & 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.

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

  • ํŒจํ„ด: Two Pointers, Greedy
  • ์„ค๋ช…: ๋ฌธ์ž์—ด์„ ์ •๊ทœํ™”ํ•œ ๋’ค ์–‘ ๋์—์„œ ํฌ์ธํ„ฐ๋ฅผ ์ด๋™์‹œํ‚ค๋ฉฐ ๋น„๊ตํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ํšŒ๋ฌธ ์—ฌ๋ถ€๋ฅผ ํŒ๋‹จํ•œ๋‹ค. ๋‘ ํฌ์ธํ„ฐ๋ฅผ ๋™์‹œ์— ์›€์ง์ด๋ฉฐ ์ค‘์•™์œผ๋กœ ์ˆ˜๋ ดํ•˜๋Š” ํŒจํ„ด์ด๋‹ค.

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

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

ํ”ผ๋“œ๋ฐฑ: ์ž…๋ ฅ ๋ฌธ์ž์—ด์„ ์ •๊ทœํ™”ํ•˜๊ณ  ์–‘ ๋์—์„œ ํˆฌํฌ์ธํ„ฐ๋กœ ๋น„๊ตํ•œ๋‹ค.

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

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

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.

1 participant