Skip to content

Commit 22eeedb

Browse files
author
tyreke.xu
committed
add
1 parent c4c92ac commit 22eeedb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/com/blankj/easy/_108/Solution.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@
1212
* </pre>
1313
*/
1414
public class Solution {
15-
public TreeNode sortedArrayToBST(int[] nums) {
16-
if (nums == null || nums.length == 0) return null;
15+
private TreeNode sortedArrayToBST(int[] nums) {
16+
if (nums == null || nums.length == 0) {
17+
return null;
18+
}
1719
return helper(nums, 0, nums.length - 1);
1820
}
1921

2022
private TreeNode helper(int[] nums, int left, int right) {
21-
if (left > right) return null;
23+
if (left > right) {
24+
return null;
25+
}
2226
int mid = (left + right) >>> 1;
2327
TreeNode node = new TreeNode(nums[mid]);
2428
node.left = helper(nums, left, mid - 1);

0 commit comments

Comments
 (0)