Skip to content

[Yiseull] WEEK 11 Solutions - #2853

Merged
parkhojeong merged 2 commits into
DaleStudy:mainfrom
Yiseull:week11
Sep 5, 2026
Merged

[Yiseull] WEEK 11 Solutions#2853
parkhojeong merged 2 commits into
DaleStudy:mainfrom
Yiseull:week11

Conversation

@Yiseull

@Yiseull Yiseull commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

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

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

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

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

Important

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

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

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.

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

merge-intervals/Yiseull.java
class Solution {
    public int[][] merge(int[][] intervals) {
        Arrays.sort(intervals, (o1, o2) -> o1[0] - o2[0]);

        int index = 0;
        for (int i = 0; i < intervals.length; i++) {
            if (intervals[index][1] < intervals[i][0]) {
                intervals[++index] = intervals[i];
            } else {
                intervals[index][1] = Math.max(intervals[index][1], intervals[i][1]);
            }
        }

        return Arrays.copyOf(intervals, index + 1);
    }
}
  • ํŒจํ„ด: Two Pointers, Greedy, Sort
  • ์„ค๋ช…: ๊ฐ„๋‹จํ•œ ์ •๋ ฌ ํ›„ ํˆฌํฌ์ธํ„ฐ๋กœ ์ค‘๋ณต ๊ตฌ๊ฐ„์„ ํ•ฉ์น˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค. ์—ฐ์† ๊ตฌ๊ฐ„ ๋น„๊ต ๋ฐ ํ•ฉ์น˜๊ธฐ ๊ณผ์ •์ด ํ•ต์‹ฌ์ด๋ฉฐ, ๋‘ ํฌ์ธํ„ฐ๋กœ ๊ตฌ๊ฐ„ ๋ฐฐ์—ด์„ ํ•œ ๋ฒˆ ์ˆœํšŒํ•ฉ๋‹ˆ๋‹ค.

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

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

ํ”ผ๋“œ๋ฐฑ: ์ž…๋ ฅ ๊ตฌ๊ฐ„์„ ์‹œ์ž‘์  ๊ธฐ์ค€์œผ๋กœ ์ •๋ ฌํ•œ ๋’ค, ํ˜„์žฌ ๊ตฌ๊ฐ„๊ณผ ๋‹ค์Œ ๊ตฌ๊ฐ„์˜ ๊ด€๊ณ„๋ฅผ ๊ฒ€์‚ฌํ•˜๋ฉฐ ํ•„์š” ์‹œ ํ•ฉ์น˜๋Š” ๋ฐฉ์‹์œผ๋กœ ํ•œ ๋ฒˆ์˜ ์ˆœํšŒ๋กœ ์ตœ์ข… ๊ตฌ๊ฐ„๋“ค์„ ์–ป์Šต๋‹ˆ๋‹ค.

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

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

@dalestudy

dalestudy Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

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

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

๋ฌธ์ œ ๋‚œ์ด๋„ ์œ ํ˜• ๋ถ„์„
merge-intervals Medium โœ… ์˜๋„ํ•œ ์œ ํ˜•
missing-number Easy โœ… ์˜๋„ํ•œ ์œ ํ˜•

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

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

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

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

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

๐Ÿ”ข API ์‚ฌ์šฉ๋Ÿ‰ (gpt-5-nano)
์š”์ฒญ ์ž…๋ ฅ ํ† ํฐ ์ถœ๋ ฅ ํ† ํฐ ํ•ฉ๊ณ„ ๋น„์šฉ
1 335 47 382 $0.000036
2 638 88 726 $0.000067
ํ•ฉ๊ณ„ 973 135 1,108 $0.000103

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.

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

missing-number/Yiseull.java
class Solution {
    public int missingNumber(int[] nums) {
        int n = nums.length;
        int expectedSum = n * (n + 1) / 2;
        int actualSum = 0;

        for (int num : nums) {
            actualSum += num;
        }

        return expectedSum - actualSum;
    }
}
  • ํŒจํ„ด: Greedy, Bit Manipulation, Dynamic Programming, Divide and Conquer, Hash Map / Hash Set, Two Pointers, Sliding Window, Fast & Slow Pointers, BFS, DFS, Backtracking, Union Find, Trie, Monotonic Stack, Heap / Priority Queue, Binary Search, Divide and Conquer, Monotonic Stack
  • ์„ค๋ช…: ํ•ด๋‹น ์ฝ”๋“œ๋Š” ๋“ฑ์ฐจํ•ฉ์„ ์ด์šฉํ•ด ๋ˆ„๋ฝ๋œ ์ˆซ์ž๋ฅผ ๊ตฌํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ, ํŒจํ„ด์€ ๋ณดํ†ต '์ˆ˜ํ•™์  ์ ‘๊ทผ'์— ๊ฐ€๊นŒ์šด ๊ทธ๋ฆฌ๋””๋‚˜ ๋น„ํŠธ ์กฐํ•ฉ ํŒจํ„ด์œผ๋กœ๋„ ํ•ด์„ ๊ฐ€๋Šฅํ•˜์ง€๋งŒ ์ฃผ๋กœ ํ•ฉ์˜ ์ฐจ๋ฅผ ์ด์šฉํ•˜๋Š” ์•„์ด๋””์–ด๋Š” DP/ํƒ์ƒ‰๊ณผ ๋ฌด๊ด€ํ•ฉ๋‹ˆ๋‹ค. ๋ณธ ๊ฒฝ์šฐ์— ๊ฐ€์žฅ ์ ์ ˆํ•œ ํŒจํ„ด์€ Greedy ํ˜น์€ Bit Manipulation์œผ๋กœ ๊ฐ„์ฃผ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

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

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

ํ”ผ๋“œ๋ฐฑ: ๋ฐฐ์—ด์˜ ๋ชจ๋“  ์›์†Œ๋ฅผ ํ•œ ๋ฒˆ ์ˆœํšŒํ•˜๋ฉฐ ํ•ฉ์„ ๊ตฌํ•˜๊ณ , ๊ฐ€์šฉํ•œ ์‚ฐ์ˆ ๋กœ ๋ˆ„๋ฝ๋œ ์ˆซ์ž๋ฅผ ๊ณ„์‚ฐํ•ฉ๋‹ˆ๋‹ค.

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

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

@okyungjin okyungjin 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.

๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค๐Ÿ™‚

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.

ํŒŒ์ด์ฌ์—๋Š” sum ํ•จ์ˆ˜๊ฐ€ ์žˆ์–ด์„œ ์ฐพ์•„๋ณด๋‹ˆ ์ž๋ฐ”์—์„œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!
for๋กœ ํ•ฉ์‚ฐํ•˜๋Š” ๊ฒƒ๊ณผ ์ฐจ์ด๊ฐ€ ์žˆ์œผ๋ ค๋‚˜์š”?

Arrays.stream(nums).sum();

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.

์ž๋ฐ”์—์„œ for๋ฌธ์ด๋ž‘ stream์ด๋ž‘ ์•ฝ๊ฐ„์˜ ์„ฑ๋Šฅ์ด๋ž‘ ๋™์ž‘ ์ฐจ์ด๊ฐ€ ์žˆ๋Š”๋ฐ, ์ €๋Š” ์ด ํ’€์ด์—์„œ๋Š” ๊ทธ๋Ÿฐ๊ฒƒ๊นŒ์ง„ ๋”ฐ์ง€์ง€ ์•Š๊ณ  for๋ฌธ์„ ์“ฐ๊ธด ํ–ˆ์–ด์š” ใ…Ž

ํด๋กœ๋“œํ•œํ…Œ ๋ฌผ์–ด๋ณด๋‹ˆ ์•„๋ž˜์ผ ๋•Œ ์–ด๋–ค ๊ฑธ ์„ ํƒํ•˜๋Š”๊ฒŒ ์ข‹์€์ง€ ์ •๋ฆฌํ•ด์ฃผ๋„ค์š”~!

  • ๋ฐ์ดํ„ฐ ๋ณ€ํ™˜ยท์ง‘๊ณ„ ํŒŒ์ดํ”„๋ผ์ธ(filter โ†’ map โ†’ collect, groupingBy) โ†’ stream์ด ์••๋„์ ์œผ๋กœ ์ฝ๊ธฐ ์ข‹์Šต๋‹ˆ๋‹ค
  • ์ธ๋ฑ์Šค๊ฐ€ ํ•„์š”ํ•˜๊ฑฐ๋‚˜ ๋‘ ๋ฆฌ์ŠคํŠธ๋ฅผ ๋™์‹œ์— ์ˆœํšŒ โ†’ for๋ฌธ
  • ๋ฃจํ”„ ๋‚ด์—์„œ ์™ธ๋ถ€ ์ƒํƒœ๋ฅผ ๋ฐ”๊ฟ”์•ผ ํ•จ โ†’ for๋ฌธ (stream์—์„œ ํ•˜๋ฉด side effect๋ผ ๋ณ‘๋ ฌ ์‹œ ๊นจ์ง‘๋‹ˆ๋‹ค)
  • ์กฐ๊ธฐ ์ข…๋ฃŒ + ๋ณต์žกํ•œ ์กฐ๊ฑด ๋ถ„๊ธฐ โ†’ for๋ฌธ
  • ์›์‹œ ํƒ€์ž… ๋Œ€๋Ÿ‰ ์—ฐ์‚ฐ์˜ ํ•ซํŒจ์Šค โ†’ for๋ฌธ, ํ˜น์€ IntStream

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.

์ €๋Š” ์ •๋‹ต ๋ฐฐ์—ด์„ ์„ ์–ธํ–ˆ๋Š”๋ฐ, intervals ๋ฐฐ์—ด์„ ์ธํ”Œ๋ ˆ์ด์Šค๋กœ ์ˆ˜์ •ํ•œ ํ›„์— ์Šฌ๋ผ์ด์Šคํ•˜์…จ๊ตฐ์š”

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.

๋„ค๋„น! okyungjin๋‹˜ ๋ฆฌ๋ทฐ ๋‹ฌ ๋•Œ ์•ˆ๊ทธ๋ž˜๋„ ์ธํ”Œ๋ ˆ์ด์Šค ๋ฐฉ๋ฒ• ๋ง์”€๋“œ๋ฆฌ๋ ค๋‹ค๊ฐ€ ๋ง์•˜์—ˆ๋Š”๋ฐ, ํด๋กœ๋“œ ๋ง๋กœ๋Š” ์ž๋ฐ”์—์„œ ์ธํ”Œ๋ ˆ์ด์Šค๊ฐ€ ์˜๋ฏธ ์žˆ์—ˆ๋˜ ๊ฑด ArrayList ์ฆ์„ค + ๊ตฌ๊ฐ„๋งˆ๋‹ค clone() + toArray ๋ณต์‚ฌ๊ฐ€ ํ•œ๊บผ๋ฒˆ์— ์‚ฌ๋ผ์กŒ๊ธฐ ๋•Œ๋ฌธ์ธ๋ฐ, ํŒŒ์ด์ฌ์€ ์—†์–ด์ง€๋Š” ๊ฒŒ ๋ฆฌ์ŠคํŠธ ๊ฐ์ฒด ํ•˜๋‚˜์™€ append ํ˜ธ์ถœ๋ฟ์ด๋ผ ์ž๋ฐ”๋งŒํผ์— ํฐ ์ด๋“์€ ์•„๋‹ˆ๋ผ๊ณ  ํ•˜๋”๋ผ๊ตฌ์š”!

@parkhojeong
parkhojeong merged commit 61e21d8 into DaleStudy:main Sep 5, 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.

3 participants