题解 | #二叉树的最大深度#

合并两个排序的链表

http://www.nowcoder.com/practice/d8b6b4358f774294a89de2a6ac4d9337

/function ListNode(x){ this.val = x; this.next = null; }/ function Merge(pHead1, pHead2) { // write code here if(!pHead1) { return pHead2 } if(!pHead2) { return pHead1 } let head if(pHead1.val < pHead2.val) { head = pHead1 head.next = Merge(pHead1.next,pHead2) } else { head = pHead2 head.next = Merge(pHead2.next,pHead1) } return head } module.exports = { Merge : Merge };

全部评论

相关推荐

01-07 07:54
已编辑
门头沟学院 前端工程师
点赞 评论 收藏
分享
黑皮白袜臭脚体育生:简历条例统一按使用了什么技术实现了什么功能解决了问题或提升了什么性能指标来写会好些,如使用布隆过滤器实现了判断短链接是否存在,大大提升了查询速度
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务