Skip to content

Conversation

@kazukiii
Copy link
Owner

@kazukiii kazukiii commented Oct 2, 2024

問題へのリンク
https://leetcode.com/problems/longest-increasing-subsequence/description/

次に解く問題
53. Maximum Subarray

README.mdへ頭の中の言語化と記録をしています。

- `end_minimums_of_is`, `sub_seq_minimums`, `smallest_value_of_subseq` など候補
- これらを考慮して `end_minimums_of_subsequence` が個人的に良さそう
- https://github.com/fhiyo/leetcode/pull/32

Copy link

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

Copy link
Owner Author

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)

Choose a reason for hiding this comment

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

ここはlen_numsくらいにした方が良いと思いました。

Copy link
Owner Author

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)

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ではセグメント木をライブラリとして使ってやってみる
Copy link

Choose a reason for hiding this comment

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

セグメント木はソフトウェアエンジニアの常識には含まれていないと思います。

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.

5 participants