因为leetcode基本都是给个数组也没有生成的树代码,在leetcode调试也90一个月忒贵了买不起,所以随手写个生成树的代码,网上都是JAVA C++版本的,用JS写一个生成树的代码
function TreeNode(val) {
this.val = val
this.left = this.right = null
}
const creatTree=function(src) {
let root = new TreeNode(
因为leetcode基本都是给个数组也没有生成的树代码,在leetcode调试也90一个月忒贵了买不起,所以随手写个生成树的代码,网上都是JAVA C++版本的,用JS写一个生成树的代码
function TreeNode(val) {
this.val = val
this.left = this.right = null
}
const creatTree=function(src) {
let root = new TreeNode(