108. Convert Sorted Array to Binary Search Tree#24
Open
TakayaShirai wants to merge 1 commit intomainfrom
Open
Conversation
mamo3gr
reviewed
Feb 17, 2026
| return null; | ||
| } | ||
|
|
||
| final midIndex = nums.length ~/ 2; |
There was a problem hiding this comment.
Dartだとinteger divisionはこう書けるんですね。勉強になります。
mamo3gr
reviewed
Feb 17, 2026
| // 再帰の方が直感的ですぐ書けるが、感覚的に書けるやつ練習してもあまり意味がないので、面倒な方で書く。 | ||
| class Solution { | ||
| TreeNode? sortedArrayToBST(List<int> nums) { | ||
| TreeNode? buildRoot(List<int> nums) { |
There was a problem hiding this comment.
build と聞くとまあまあ複雑な処理を想像しました。これなら pick などもう少し軽い処理を連想させる単語を使ってもいいかもしれません。
Owner
Author
There was a problem hiding this comment.
レビューありがとうございます!
確かに pick の方が操作の意味と合っている感じがして良いですね。参考になります。
|
特に違和感ありませんでした 👍 私はDartは馴染みが無いのですが、それでもスッと読めるくらい毎回分かりやすく書いてくださってありがとうございます。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
解いた問題:https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/description/
次に解く問題:https://leetcode.com/problems/path-sum/description/