Skip to content

[Yiseull] WEEK 03 Solutions#2720

Open
Yiseull wants to merge 6 commits into
DaleStudy:mainfrom
Yiseull:main
Open

[Yiseull] WEEK 03 Solutions#2720
Yiseull wants to merge 6 commits into
DaleStudy:mainfrom
Yiseull:main

Conversation

@Yiseull

@Yiseull Yiseull commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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

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

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

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

Important

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

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

@dalestudy

dalestudy Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

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

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

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

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

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

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

์นดํ…Œ๊ณ ๋ฆฌ ์ง„ํ–‰๋„ ์™„๋ฃŒ
Array โ– โ– โ– โ–กโ–กโ–กโ–ก 4 / 10 (Medium 2, Easy 2)
Heap โ– โ– โ–กโ–กโ–กโ–กโ–ก 1 / 3 (Medium 1)
Graph โ– โ–กโ–กโ–กโ–กโ–กโ–ก 1 / 8 (Medium 1)
String โ– โ–กโ–กโ–กโ–กโ–กโ–ก 1 / 10 (Easy 1)
Dynamic Programming โ– โ–กโ–กโ–กโ–กโ–กโ–ก 1 / 11 (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 423 51 474 $0.000042
2 423 47 470 $0.000040
3 661 85 746 $0.000067
4 1,037 150 1,187 $0.000112
5 1,756 210 1,966 $0.000172
ํ•ฉ๊ณ„ 4,300 543 4,843 $0.000432

(cherry picked from commit d881c4d)
@DaleSeo DaleSeo self-requested a review July 9, 2026 00:02

@DaleSeo DaleSeo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค! ์•„์ฃผ ๋งˆ์ด๋„ˆํ•œ ํ”ผ๋“œ๋ฐฑ ๋“œ๋ ธ์–ด์šฉ~

Comment thread number-of-1-bits/Yiseull.java Outdated
@@ -0,0 +1,5 @@
class Solution {
public int hammingWeight(int n) {
return Integer.bitCount(n);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

์˜ท, ์š”๋Ÿฐ ํ’€์ด๋Š” ์ถœ์ œ ์˜๋„์™€ ๋งž์ง€ ์•Š์„์ง€๋„? ๋ฉด์ ‘๊ด€์ด Integer.bitCount์ด ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š” ๊นŠ๊ณ  ํŒŒ๊ณ  ๋“ค๋ฉด ์ธํ„ฐ๋ทฐ๊ฐ€ ๋ง๋ฆด ์ˆ˜๋„ ์žˆ๊ณ ์š”. ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ์—์„œ ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์€ ์–‘๋‚ ์˜ ๊ฒ€์ด ๋  ์ˆ˜ ์žˆ์œผ๋‹ˆ ์ฐธ๊ณ  ๋ฐ”๋ž๋‹ˆ๋‹ค.

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.

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

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
  • ์„ค๋ช…: ๊นŠ์ด ์šฐ์„  ํƒ์ƒ‰์œผ๋กœ ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  ์กฐํ•ฉ์„ ํƒ์ƒ‰ํ•˜๋ฉฐ, ํƒ€๊นƒ์— ๋„๋‹ฌํ•˜๋ฉด ํ•ด๋ฅผ ์ˆ˜์ง‘ํ•˜๋Š” ๋ฐฑํŠธ๋ž˜ํ‚น ํŒจํ„ด์˜ ์ „ํ˜•์ ์ธ ๊ตฌํ˜„์ž…๋‹ˆ๋‹ค. ์ค‘๋ณต ์—†์ด ์„ ํƒ ๊ฐ€๋Šฅํ•˜๋„๋ก ์‹œ์ž‘ ์ธ๋ฑ์Šค๋ฅผ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.

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

๋ณต์žก๋„
Time O(K * N)
Space O(N)

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

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

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

Comment thread decode-ways/Yiseull.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
  • ์„ค๋ช…: ์ฃผ์–ด์ง„ ์ฝ”๋“œ๋Š” ๋ฌธ์ž์—ด์„ 1,2์ž๋ฆฌ ์ˆซ์ž๋กœ ํ•ด์„ํ•ด ๊ฐ€๋Šฅํ•œ ๊ฒฝ์šฐ์˜ ์ˆ˜๋ฅผ ๋ˆ„์  ํ•ฉ์œผ๋กœ ๊ณ„์‚ฐํ•˜๋Š” ์ „ํ˜•์ ์ธ DP(0/1 ๊ณ„๋‹จ์‹) ๋ฌธ์ œ ํ’€์ด ํŒจํ„ด์ด๋‹ค.

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

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

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

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

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

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
  • ์„ค๋ช…: ์ตœ๋Œ€ ๋ถ€๋ถ„๋ฐฐ์—ด ๋ฌธ์ œ๋ฅผ ํ•œ ๋ฃจํ”„์—์„œ ๋ˆ„์ ํ•ฉ๊ณผ ๋ถ€๋ถ„ํ•ด๋ฅผ ๋น„๊ตํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ํ•ด๊ฒฐํ•˜๋ฏ€๋กœ ๊ทธ๋ฆฌ๋”” ํŒจํ„ด์— ์†ํ•˜๋ฉฐ, ๋ถ€๋ถ„ํ•ฉ์˜ ์ตœ๋Œ“๊ฐ’์„ ์œ ์ง€ํ•˜๋Š” ์ ์—์„œ DP์˜ ์ตœ์  ๋ถ€๋ถ„๊ตฌ์กฐ ์•„์ด๋””์–ด์™€๋„ ์—ฐ๊ด€๋œ๋‹ค.

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

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

ํ”ผ๋“œ๋ฐฑ: ํ˜„์žฌ ํ’€์ด์—์„œ tmp๋ฅผ ๋ˆ„์ ํ•˜๊ณ  ์ตœ๋Œ“๊ฐ’์„ ๊ฐฑ์‹ ํ•˜๋Š” ํ‘œ์ค€ ๋ฐฉ์‹์ด๋‹ค.

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

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

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
  • ์„ค๋ช…: ์ฃผ์–ด์ง„ ์ฝ”๋“œ๋Š” ๋น„ํŠธ ์—ฐ์‚ฐ์„ ์ด์šฉํ•ด 1๋น„ํŠธ์˜ ๊ฐœ์ˆ˜๋ฅผ ์„ธ๋Š” ๋ฐฉ์‹์ด๋‹ค. n & (n-1) ์—ฐ์‚ฐ์œผ๋กœ ์ตœํ•˜์œ„ 1์„ ์ œ๊ฑฐํ•˜๋Š” ํŠธ๋ฆญ์€ ๋น„ํŠธ ์กฐ์ž‘ ํŒจํ„ด์˜ ๋Œ€ํ‘œ ์˜ˆ์ด๋‹ค.

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

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

ํ”ผ๋“œ๋ฐฑ: n & (n-1) ํŠธ๋ฆญ์œผ๋กœ 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, Hash Map / Hash Set
  • ์„ค๋ช…: ์ฃผ ์ฝ”๋“œ์˜ ๋‘ ๋ฒˆ์งธ ํ’€์ด์—์„œ ์ขŒ์šฐ ํฌ์ธํ„ฐ๋ฅผ ์ด๋™ํ•˜๋ฉด์„œ ๋ฌธ์ž ํ•„ํ„ฐ๋ง ๋ฐ ๋Œ€์†Œ๋ฌธ์ž ๋น„๊ต๋ฅผ ํ†ตํ•ด ํšŒ๋ฌธ ์—ฌ๋ถ€๋ฅผ ํŒ๋‹จํ•œ๋‹ค. ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์–‘์ชฝ์—์„œ ๊ฐ๊ฐ ๋น„๊ตํ•˜๋ฉฐ ์กฐ๊ฑด์— ๋งž์ง€ ์•Š์œผ๋ฉด ์ฆ‰์‹œ ๋ฐ˜ํ™˜ํ•˜๋ฏ€๋กœ ํˆฌ ํฌ์ธํ„ฐ(์ขŒ์šฐ ํฌ์ธํ„ฐ) ํŒจํ„ด์— ํ•ด๋‹นํ•œ๋‹ค. ํ•„์š” ์‹œ ๋ถˆํ•„์š” ๋ฌธ์ž ๊ฑด๋„ˆ๋›ฐ๊ธฐ ๋กœ์ง์€ ๊ทธ๋ฆฌ๋””์  ํ๋ฆ„์œผ๋กœ ์ง„ํ–‰๋œ๋‹ค.

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

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

ํ”ผ๋“œ๋ฐฑ: 2๊ฐ€์ง€ ๊ตฌํ˜„ ์ค‘ ํ˜„์žฌ๋Š” ํˆฌ ํฌ์ธํ„ฐ ๋ฐฉ์‹์œผ๋กœ ์ถ”๊ฐ€ ๊ณต๊ฐ„ ์—†์ด ์ง„ํ–‰ํ•œ๋‹ค.

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

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

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