Skip to content

[bus710] Week 09#984

Merged
bus710 merged 1 commit intoDaleStudy:mainfrom
bus710:week09
Feb 8, 2025
Merged

[bus710] Week 09#984
bus710 merged 1 commit intoDaleStudy:mainfrom
bus710:week09

Conversation

@bus710
Copy link
Contributor

@bus710 bus710 commented Feb 2, 2025

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

์ฒดํฌ ๋ฆฌ์ŠคํŠธ

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

@bus710 bus710 requested a review from a team as a code owner February 2, 2025 04:43
@github-actions github-actions bot added the go label Feb 2, 2025
@bus710 bus710 requested a review from gwbaik9717 February 2, 2025 04:43
@bus710
Copy link
Contributor Author

bus710 commented Feb 2, 2025

๋ฌธ์ œ 1์„ ๋‘๋ฒˆ ํ’€์–ด ๋ณด์•˜์Šต๋‹ˆ๋‹ค.

์ฒซ๋ฒˆ์งธ ํ’€์ด๊ฐ€ ์„ฑ๋Šฅ์ด ๋„ˆ๋ฌด ์•ˆ ์ข‹์€ ๊ฒƒ ๊ฐ™์•„์„œ, ๋‘๋ฒˆ์งธ๋Š” ๋‹จ์ˆœํ•˜๊ฒŒ ๋ฃจํ”„์— ๋Œ๋ ค๋ณด์•˜์Šต๋‹ˆ๋‹ค.
๋‘๋ฒˆ์งธ ํ’€์ด์˜ ์„ฑ๋Šฅ์ด ๋‚˜์•„์ง€๊ธด ํ–ˆ์ง€๋งŒ ์•„์‰ฝ๊ฒŒ๋„ ํฐ ์ฐจ์ด๋Š” ์—†๋„ค์š”. ์–ด๋–ค ๋ถ€๋ถ„์ด ๋ฌธ์ œ์ผ์ง€ ใ…Žใ…Ž

์•”ํŠผ ๊ฐ„์—, ์‹œ๊ฐ„/๊ณต๊ฐ„ ๋ณต์žก๋„๋Š” ๋‘˜ ๋‹ค O(n)์ด๋ผ๊ณ  ์ƒ๊ฐ ํ•ฉ๋‹ˆ๋‹ค. ์ฃผ์–ด์ง„ ๋ฆฌ์ŠคํŠธ์˜ ๋…ธ๋“œ ์ˆ˜ ๋งŒํผ, ๋งต์˜ ์•„์ดํ…œ ์ˆ˜๊ฐ€ ์ฆ๊ฐ€ํ•˜๊ธฐ ๋•Œ๋ฌธ์—, ๊ทธ๋ฆฌ๊ณ  ์žฌ๊ท€๋˜ ๋ฃจํ”„๋˜ ํ•œ๋ฒˆ์”ฉ์€ ๋‹ค ๋ฐฉ๋ฌธํ•˜๊ฒŒ ์งœ๋†“์•˜๊ธฐ ๋•Œ๋ฌธ์—์š”.

(๊ถ๊ธˆํ•ด์„œ ์†”๋ฃจ์…˜์„ ์ฐพ์•„ ๋ณด์•˜์Šต๋‹ˆ๋‹ค. ์ƒ๊ฐ๋ณด๋‹ค ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ๋‘๋ฐฐ ์ด์ƒ ๋น ๋ฅด๊ฒŒ ํ’€ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์ด ์žˆ์—ˆ๋„ค์š”. ๋ฆฌ๋ทฐ์–ด๋ถ„๋“ค๊ป˜ ์Šคํฌ๊ฐ€ ๋  ์ˆ˜ ์žˆ์œผ๋‹ˆ ์ ์ง€ ์•Š๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.)

Copy link
Contributor

@gwbaik9717 gwbaik9717 left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š”, @bus710 ๋‹˜! ์ด๋ฒˆ ๋ฆฌ๋ทฐ๋Š” ์กฐ๊ธˆ ๋Šฆ์—ˆ์Šต๋‹ˆ๋‹ค. ์ฝ”๋ฉ˜ํŠธ ๋ช‡ ๊ฐœ ๋‚จ๊ฒจ ๋‘์—ˆ์œผ๋‹ˆ ์‹œ๊ฐ„๋˜์‹ค ๋•Œ ํ™•์ธํ•ด์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ์ฃผ๋„ ์ˆ˜๊ณ ํ•˜์…จ์Šต๋‹ˆ๋‹ค!

return false
}
m := map[*ListNode]int{}
for head.Next != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

for ๋ฌธ์˜ ์กฐ๊ฑด์— head.Next != nil ๊ฐ€ ์•„๋‹Œ head != nil ๋กœ ํ•˜๋ฉด, 31 ๋ฒˆ์งธ ์ค„์˜ if ๋ฌธ์ด ํ•„์š”์—†๊ฒŒ ๋˜์–ด์„œ ์ฝ”๋“œ๊ฐ€ ์กฐ๊ธˆ ๋” ๊น”๋”ํ•ด์ง€์ง€ ์•Š์„๊นŒ ์ƒ๊ฐ์ด ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์ฒซ๋ฒˆ์งธ ์กฐ๊ฑด์€ ์‚ฌ์‹ค ์ œ์ถœํ•˜๋ฉด์„œ ์ถ”๊ฐ€ ๋œ ์—๋Ÿฌ๋ฅผ ํ•ธ๋“ค๋งํ•˜๋А๋ผ ๋ถ™์˜€๋”๋‹ˆ ๊ทธ๋ ‡๊ฒŒ ํ†ตํ•ฉ ๋  ์ˆ˜๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™๋„ค์š”.

m := map[*ListNode]int{}
for head.Next != nil {
if _, ok := m[head]; !ok {
m[head] = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

ํ˜„์žฌ ์„ ์–ธํ•ด๋‘์‹  m ์€ key ์˜ ์กด์žฌ ์—ฌ๋ถ€๋งŒ ํ™•์ธํ•˜๋ฉด ๋˜๊ธฐ ๋•Œ๋ฌธ์— value ์˜ ์—ญํ• ์€ ์‚ฌ์‹ค์ƒ ํฐ ์˜๋ฏธ๊ฐ€ ์—†์–ด ๋ณด์ž…๋‹ˆ๋‹ค. ์ €๋Š” go ์–ธ์–ด๋ฅผ ์ž˜์•Œ์ง€๋Š” ๋ชปํ•˜์ง€๋งŒ, int ๋Œ€์‹  struct{} ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ณ„๋„์˜ ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„ ํ• ๋‹น์ด ํ•„์š”์—†๋‹ค๊ณ  ํ•˜๋”๋ผ๊ตฌ์š”. ์ฆ‰, m := map[*ListNode]struct{}{} ๊ฒŒ m ์˜ ํƒ€์ž…์„ ๋ณ€๊ฒฝํ•  ์ˆ˜๋„ ์žˆ์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๋ฌผ๋ก , ๊ทธ๋Ÿผ์—๋„ ๋ฉ”๋ชจ๋ฆฌ์ƒ ํฐ ์ฐจ์ด๋Š” ์—†์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์˜ค ์ €๋„ ๋“ค์–ด๋ณธ ๊ฒƒ ๊ฐ™์€ ์–˜๊ธฐ๋„ค์š”. ์•„๋งˆ๋„ ํฌ์ธํ„ฐ๋กœ ๋‹ค๋ฃจ๊ธฐ ๋•Œ๋ฌธ์— ๊ตฌ์กฐ์ฒด๋ฅผ ๊ฐ’์œผ๋กœ ์“ฐ๋ฉด ๊ณต๊ฐ„์ด ๋œ ๋“ ๋‹ค๊ณ  ํ–ˆ๋˜ ๊ฒƒ ๊ฐ™๊ธฐ๋„...

@bus710 bus710 merged commit e9cc8ac into DaleStudy:main Feb 8, 2025
3 checks passed
@bus710 bus710 deleted the week09 branch February 8, 2025 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants