Skip to content

Conversation

katataku
Copy link
Owner

@katataku katataku commented Dec 6, 2024

num_to_index[target - num] = i
```

最後に気づいたけど、`num_to_index`より`complement_to_index`の方が、より適切な名前かもしれない。

Choose a reason for hiding this comment

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

かたおかさんの実装だとそんな気がします。個人的にはnum_to_indexにはnumとそのindexを入れて、要素を取得する際にtarget - numでアクセスするほうが自然なようには思います。

- https://github.com/tarinaihitori/leetcode/pull/11
- https://github.com/haniwachann/leetcode/pull/2
- https://github.com/philip82148/leetcode-arai60/pull/1

Copy link

Choose a reason for hiding this comment

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

入力を sort をして頭と尻尾から探していくという手もあるように思います。

Copy link

@philip82148 philip82148 left a comment

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.

4 participants