File tree Expand file tree Collapse file tree 8 files changed +63
-0
lines changed Expand file tree Collapse file tree 8 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ package index
2
+
3
+ func InsertIntoMaxTree (root * TreeNode , val int ) * TreeNode {
4
+ return insertIntoMaxTree (root , val )
5
+ }
Original file line number Diff line number Diff line change
1
+ module github.com/masx200/leetcode-test/maximum-binary-tree-ii
2
+
3
+ go 1.19
4
+
5
+ require github.com/masx200/leetcode-test/serialize-and-deserialize-binary-tree v0.0.0
6
+
7
+ replace github.com/masx200/leetcode-test/serialize-and-deserialize-binary-tree v0.0.0 => ../serialize-and-deserialize-binary-tree
Original file line number Diff line number Diff line change
1
+ github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg =
2
+ gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo =
Original file line number Diff line number Diff line change
1
+ package index
2
+
3
+ import serialize_and_deserialize_binary_tree "github.com/masx200/leetcode-test/serialize-and-deserialize-binary-tree"
4
+
5
+ type TreeNode = serialize_and_deserialize_binary_tree.TreeNode
6
+
7
+ func insertIntoMaxTree (root * TreeNode , val int ) * TreeNode {
8
+ if root == nil || root .Val < val {
9
+ return & TreeNode {Val : val , Left : root }
10
+
11
+ }
12
+
13
+ root .Right = insertIntoMaxTree (root .Right , val )
14
+ return root
15
+ }
Original file line number Diff line number Diff line change
1
+ package index
2
+
3
+ func ConstructMaximumBinaryTree (nums []int ) * TreeNode {
4
+ return constructMaximumBinaryTree (nums )
5
+ }
Original file line number Diff line number Diff line change
1
+ module github.com/masx200/leetcode-test/maximum-binary-tree
2
+
3
+ go 1.19
4
+
5
+ require github.com/masx200/leetcode-test/serialize-and-deserialize-binary-tree v0.0.0
6
+
7
+ require github.com/masx200/leetcode-test/maximum-binary-tree-ii v0.0.0
8
+
9
+ replace github.com/masx200/leetcode-test/maximum-binary-tree-ii v0.0.0 => ../maximum-binary-tree-ii
10
+
11
+ replace github.com/masx200/leetcode-test/serialize-and-deserialize-binary-tree v0.0.0 => ../serialize-and-deserialize-binary-tree
Original file line number Diff line number Diff line change
1
+ github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg =
2
+ gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo =
Original file line number Diff line number Diff line change
1
+ package index
2
+
3
+ import maximum_binary_tree_ii "github.com/masx200/leetcode-test/maximum-binary-tree-ii"
4
+ import serialize_and_deserialize_binary_tree "github.com/masx200/leetcode-test/serialize-and-deserialize-binary-tree"
5
+
6
+ type TreeNode = serialize_and_deserialize_binary_tree.TreeNode
7
+
8
+ var insertIntoMaxTree = maximum_binary_tree_ii .InsertIntoMaxTree
9
+
10
+ func constructMaximumBinaryTree (nums []int ) * TreeNode {
11
+ var node * TreeNode = nil
12
+ for _ , v := range nums {
13
+ node = insertIntoMaxTree (node , v )
14
+ }
15
+ return node
16
+ }
You can’t perform that action at this time.
0 commit comments