Skip to content

[u-siop] WEEK 01 solutions#2391

Merged
SamTheKorean merged 2 commits intoDaleStudy:mainfrom
u-siop:main
Mar 8, 2026
Merged

[u-siop] WEEK 01 solutions#2391
SamTheKorean merged 2 commits intoDaleStudy:mainfrom
u-siop:main

Conversation

@u-siop
Copy link
Copy Markdown
Contributor

@u-siop u-siop commented Mar 7, 2026

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

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

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

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

Important

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

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

@soobing soobing self-requested a review March 8, 2026 04:55
@@ -0,0 +1,20 @@
class Solution {
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.

์™€ ! C++๋กœ ํ‘ธ์‹œ๋Š”๊ตฐ์š” ๐Ÿ˜Š ์˜ค๋žœ๋งŒ์ด๋„ค์š” ใ…Žใ…Ž

์ด Extension ์จ๋ณด์…จ๋‚˜์š”?
https://discord.com/channels/775115965964222492/1229860988170403901/1479017249691013132

๋ฌธ์ œ๋ฅผ ๋น ๋ฅด๊ฒŒ ํ‘ธ๋Š”๋ฐ ๋„์›€ ๋˜๋Š”๊ฑฐ ๊ฐ™์•„์š”~~ ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค.

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.

์‹œ๊ฐ„๋‚ด์–ด ์ฝ”๋ฉ˜ํŠธ ๋‹ฌ์•„์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

์ต์Šคํ…์…˜ ์‚ฌ์šฉํ•ด๋ณด๊ณ  ํ”ผ๋“œ๋ฐฑ๋„ ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

@SamTheKorean SamTheKorean merged commit b00545f into DaleStudy:main Mar 8, 2026
1 check passed
class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
// instinct : sort the array and check all the array whether duplicate or not
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.

์ตœ์ดˆ ์ ‘๊ทผ์— ๋Œ€ํ•ด ์ž‘์„ฑํ•ด์ฃผ์‹ ๊ฒŒ ์ธ์ƒ๊นŠ์Šต๋‹ˆ๋‹ค.
๊ฒฐ๊ณผ์ ์œผ๋กœ๋Š” sort์—†์ด O(n)์‹œ๊ฐ„ ๋ณต์žก๋„๋กœ ๊ฐœ์„ ๋˜์—ˆ๋„ค์š”. ๐Ÿ‘

// time complexity : NlogN(sort) + N(check all the array)
// space complexity : 1

// how do we, in real world, judge there is a duplicated element, definitely need a reference( another data strucrue) to check
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.

์ง๊ด€์ ์ธ ํ•ด๊ฒฐ์ฑ…์„ ์„œ์ˆ ํ•˜์‹  ์ธก๋ฉด๋„ ์ธ์ƒ๊นŠ์Šต๋‹ˆ๋‹ค. ์–ด๋–ค ์ƒ๊ฐ์œผ๋กœ ๋กœ์ง์„ ์ž‘์„ฑํ•˜์…จ๋Š”์ง€ ํ™•์ธ ํ•  ์ˆ˜ ์žˆ์–ด์„œ ํฅ๋ฏธ๋กญ๋„ค์š”.

for (const auto& i : nums) {
if (seen[i] >= 1)
return true;
seen[i] = true;
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.

seen[i]์— true๋ฅผ ํ• ๋‹นํ•˜๋Š”๋ฐ, ์ฒดํฌ๋Š” >= 1๋กœ ์ฒ˜๋ฆฌํ•œ ๋ถ€๋ถ„์ด ๋ˆˆ์— ๋•๋‹ˆ๋‹ค. 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.

์‹œ๊ฐ„๋‚ด์–ด ํ”ผ๋“œ๋ฐฑ ์ฝ”๋ฉ˜ํŠธ ์ฃผ์…”์„œ ์ •๋ง ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

์กฐ๊ธˆ ๋” ๋‚˜์€ ์ฝ”๋“œ๋กœ ์ˆ˜์ •ํ•˜๋Š” ๊ณผ์ •์—์„œ ๋งˆ์ € ํ™•์ธํ•˜์ง€ ๋ชปํ–ˆ๋„ค์š”.

๋‹จ์ˆœํ•œ ์ฝ”ํ…Œ ๋ฌธ์ œ๋ผ๋„, ํ”„๋กœ์ ํŠธ ํ˜‘์—…ํ•œ๋‹ค๋Š” ์ƒ๊ฐ์œผ๋กœ 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.

๊นŠ๊ฒŒ ๊ณ ๋ คํ•ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!
C++๋กœ ์ผ์„ ํ•ด๋ณธ์ ์ด ์—†์–ด์„œ, ์‹ค๋ฌด์—์„  ์ข…์ข… ๊ทธ๋ ‡๊ฒŒ ํ•˜์‹œ๋Š”์ง€ ๊ถ๊ธˆํ•ด์„œ ์—ฌ์ญค๋ณธ ๋ถ€๋ถ„์ด์—ˆ์Šต๋‹ˆ๋‹ค!
ํ˜น์‹œ๋‚˜ ์ง€์ ํ•˜๋Š” ๊ฒƒ ์ฒ˜๋Ÿผ ๋А๊ปด์ง€์…จ๋‹ค๋ฉด ์ € ๋˜ํ•œ ํ‘œํ˜„์„ ์กฐ๊ธˆ ๊ฐ€๋‹ค๋“ฌ๊ฒ ์Šต๋‹ˆ๋‹ค. ใ…Žใ…Ž

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