摘要: leetcode探索中级答案汇总: https://leetcode-cn.com/explore/interview/card/top-interview-questions-medium/ 1)数组和字符串: leetcode 15 三数之和(medium)排序+双指针 leetcode73 矩 阅读全文
posted @ 2019-05-23 21:28 Joel_Wang 阅读(803) 评论(0) 推荐(0) 编辑
摘要: 由低位加到高位一般比较方便,考虑进位问题(通过引入flag和最后的if表达式),两树长度不相等的情况(通过引入三个while循环) 需要变量:pre,cur两个链表节点,记录头结点之前的节点a=new ListNode(-1) 阅读全文
posted @ 2019-05-23 21:07 Joel_Wang 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 使用哈希的方法:先将nums哈希表化,再遍历nums,寻找-nums[i]如果存在则为题目所求 阅读全文
posted @ 2019-05-23 20:59 Joel_Wang 阅读(223) 评论(0) 推荐(0) 编辑
摘要: O(n)time,O(n)space 阅读全文
posted @ 2019-05-23 17:43 Joel_Wang 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 容器unordered_map<key type,value tyep>m; 迭代器unordered_map<key type,value tyep>::iterator it; erase函数: 关于erase 函数,可以删除一个iterator位置的元素(1),可以删除从first迭代器到la 阅读全文
posted @ 2019-05-23 14:55 Joel_Wang 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 转载自https://blog.csdn.net/qjh5606/article/details/85881680 list::splice实现list拼接的功能。将源list的内容部分或全部元素删除,拼插入到目的list。 函数有以下三种声明: 一:void splice ( iterator p 阅读全文
posted @ 2019-05-23 14:38 Joel_Wang 阅读(2557) 评论(0) 推荐(0) 编辑