function createTree(treeArr) {
function TreeNode(val) {
this.val = val
this.left = this.right = null
}
const cacheObj = {}
for (let i = 0; i < treeArr.length; i++) {
cacheObj[`tree${i}`] = typeof treeArr[i] === 'number' && new TreeNode(treeArr[i])
}
for (let i = 0; i < treeArr.length; i++) {
cacheObj[`tree${2 * i + 1}`] && (cacheObj[`tree${i}`].left = cacheObj[`tree${2 * i + 1}`])
cacheObj[`tree${2 * i + 2}`] && (cacheObj[`tree${i}`].right = cacheObj[`tree${2 * i + 2}`])
}
return cacheObj['tree0']
}