Skip to content

Conversation

@fhiyo
Copy link
Owner

@fhiyo fhiyo commented Jul 16, 2024


n: len(nums)
- 時間計算量: O(log n)
- 空間計算量: O(n)

Choose a reason for hiding this comment

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

O(1)じゃないですか?引数の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.

引数のnumsを考慮に入れている?

そうです、ですが空間計算量というときにauxiliary spaceだけでなく入力も含めるのが一般的なのかいまいちよく分からないんですよね...

辺りを見ると入力含める方が普通なのかな?と思い入れるようにしてみてるんですが。

Choose a reason for hiding this comment

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

Auxiliary Space Complexityという名前があるのを初めて知りました。LeetCodeの公式の解説だとSpace ComplexityをAuxiliary Space Complexityの意味で使ってますね。

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.

3 participants