Compare commits

...

3 Commits

2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,6 @@
<<<<<<< HEAD
import TreeNode from '../../test/tree/TreeNode'
=======
/**
* Definition for a binary tree node.
*/
@ -6,6 +9,7 @@ function TreeNode(val) {
this.left = this.right = null
}
>>>>>>> 450f1f6b5d96df43627b7b8c07518b2ec772a2da
/**
* @param {number[]} nums
* @return {TreeNode}

View File

@ -1,5 +1,5 @@
import { sortedArrayToBST } from '../../src/tree/convert-sorted-array-to-binary-search-tree.js'
test('将有序数组转换为二叉搜索树', () => {
expect(sortedArrayToBST()).toEqual()
expect(sortedArrayToBST([-10, -3, 0, 5, 9])).toEqual({ left: { left: null, right: { left: null, right: null, val: -3 }, val: -10 }, right: { left: null, right: { left: null, right: null, val: 9 }, val: 5 }, val: 0 })
})