算法
Hwangyiping
这个作者很懒,什么都没留下…
展开
-
【算法】判断环形链表是否有环 | 交行2021笔试
var inp = "{(A=>B),(B=>C),(C=>E)}"; var arr = inp.slice(1, inp.length - 1).split(","); console.log(inp) function TreeNode(val = null, next = null){ this.val = val; this.next = next; } //deal with input var set = new Set(); for (let i = .原创 2020-09-28 10:59:44 · 126 阅读 · 0 评论 -
【算法】重建二叉树以及寻找樱桃节点
var preorder = [3,9,20,15,7]; var inorder = [9,3,15,20,7]; function TreeNode(val, left = null, right = null){ this.val = val; this.left = left; this.right = right; } var buildTree = function(preorder, inorder){ if(preorder.length == 0 ||.原创 2020-09-21 03:24:01 · 235 阅读 · 0 评论