Skip to content

121 best time to buy and sell stock - #36

Open
MA-yo-TA wants to merge 2 commits into
mainfrom
121-Best-Time-to-Buy-and-Sell-Stock
Open

MA-yo-TA wants to merge 2 commits into
mainfrom
121-Best-Time-to-Buy-and-Sell-Stock

Conversation

@MA-yo-TA

@MA-yo-TA MA-yo-TA commented Sep 9, 2026

Copy link
Copy Markdown
Owner

class Solution:
def maxProfit(self, prices: list[int]) -> int:
return max(
map(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

map は、読み手にとってはやや認知負荷が高くなる場合があると思います。平易な for 文等を優先したほうが良いかもしれません。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

ありがとうございます。他の方のコメントで「関数型っぽい発想」みたいなものを見かけたので書いてみたんですが、やっぱり Python にはあんまり合わないですね。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants