-
Notifications
You must be signed in to change notification settings - Fork 0
300. Longest Increasing Subsequence #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| - `end_minimums_of_is`, `sub_seq_minimums`, `smallest_value_of_subseq` など候補 | ||
| - これらを考慮して `end_minimums_of_subsequence` が個人的に良さそう | ||
| - https://github.com/fhiyo/leetcode/pull/32 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この辺類題です。一応、見ていないかもしれないので。
https://discord.com/channels/1084280443945353267/1201211204547383386/1241981541802840228
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます。類題も解いておきます。
| ```python | ||
| class Solution: | ||
| def lengthOfLIS(self, nums: List[int]) -> int: | ||
| n = len(nums) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここはlen_numsくらいにした方が良いと思いました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n とか ans とか書いてしまう悪い癖が戻ってしまっていました。ご指摘ありがとうございます。
| ```python | ||
| class Solution: | ||
| def lengthOfLIS(self, nums: List[int]) -> int: | ||
| end_minimums_of_subsequence = [math.inf] * len(nums) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
最初は空の配列を用意して、配列の右端より大きいnumが出てきたらappendする方法でもよい気がしますね
| - Step2で復習する | ||
| - セグメント木による解法もあるが、セグメント木を何も見ずに書ける自信なし、、 | ||
| - Step2でソラで書けるように練習する | ||
| - Step1ではセグメント木をライブラリとして使ってやってみる |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
セグメント木はソフトウェアエンジニアの常識には含まれていないと思います。
問題へのリンク
https://leetcode.com/problems/longest-increasing-subsequence/description/
次に解く問題
53. Maximum Subarray
README.mdへ頭の中の言語化と記録をしています。