Skip to content

[devyejin] WEEK 05 solutions #1838

Merged
devyejin merged 5 commits into
DaleStudy:mainfrom
devyejin:main
Aug 24, 2025
Merged

[devyejin] WEEK 05 solutions #1838
devyejin merged 5 commits into
DaleStudy:mainfrom
devyejin:main

Conversation

@devyejin

@devyejin devyejin commented Aug 18, 2025

Copy link
Copy Markdown
Contributor

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

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

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

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

Important

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

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

@printjin-gmailcom printjin-gmailcom 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.

์ˆ˜๊ณ ํ•˜์‹ญ๋‹ˆ๋‹ค :)

class Solution:
def maxProfit(self, prices: List[int]) -> int:
n = len(prices)
min_price = prices[0]

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.

prices๊ฐ€ ๋นˆ ๋ฐฐ์—ด์ผ ๊ฒฝ์šฐ prices[0] ์ ‘๊ทผ์—์„œ IndexError ๋ฐœ์ƒ ๊ฐ€๋Šฅ โ†’ ์ž…๋ ฅ ๊ฒ€์ฆ ํ•„์š”

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.

๋ฌธ์ œ ์กฐ๊ฑด์—์„œ prices ๊ธธ์ด๊ฐ€ 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.

์•„ ์ œ๊ฐ€ ์กฐ๊ฑด์„ ๋ชป ๋ดค๋„ค์š”. ์ด ๋ฌธ์ œ์—์„œ๋Š” ํ•ด๋‹น ์‚ฌํ•ญ ๊ณ ๋ คํ•˜์ง€ ์•Š์œผ์…”๋„ ๋ฉ๋‹ˆ๋‹ค.

Comment thread word-break/devyejin.py

for word in wordDict:
if subs.startswith(word):
if dfs(subs[len(word):]):

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.

๋ฉ”๋ชจ์ด์ œ์ด์…˜์„ ์ด์šฉํ•œ ํƒ‘๋‹ค์šด DP๋กœ ํ’€์ดํ•˜์‹  ๊ฒƒ์œผ๋กœ ๋ณด์ด๋„ค์š”! ์ฝ”๋“œ๊ฐ€ ๋ช…ํ™•ํ•˜์—ฌ ์ดํ•ดํ•˜๊ธฐ ์‰ฌ์› ์Šต๋‹ˆ๋‹ค ใ…Žใ…Žใ…Ž

์ถ”๊ฐ€๋กœ ์ด ๋ฌธ์ œ์— DP ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ #256 ๋ฌธ์ œ์—์„œ ๋‹ค๋ค˜๋˜ ํŠธ๋ผ์ด๋„ ํ•จ๊ป˜ ํ™œ์šฉํ•œ๋‹ค๋ฉด ๋งค ๋‹จ๊ณ„๋งˆ๋‹ค wordDict ์ „์ฒด๋ฅผ ์ˆœํšŒํ•˜๋ฉฐ subs.startswith(word)๋ฅผ ํ•˜๋Š” ๋ถ€๋ถ„์„ ์ตœ์ ํ™” ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค! ๋งจ ์ฒ˜์Œ์— wordDict๋ฅผ ํŠธ๋ผ์ด์— ๋„ฃ์–ด๋‘๋ฉด ์ˆœํšŒํ•  ํ•„์š” ์—†์ด ํŠธ๋ผ์ด๋ฅผ ๋”ฐ๋ผ ๋‚ด๋ ค๊ฐ€๋ฉฐ prefix๋งŒ ํ™•์ธํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ธ๋ฐ์š”, ํ•œ ๋ฒˆ ์ด๋ ‡๊ฒŒ๋„ ํ’€์–ด๋ณด์…”๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค~!

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.

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

@devyejin
devyejin merged commit 2e254d2 into DaleStudy:main Aug 24, 2025
1 check passed
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.

3 participants