摘要:
题目地址:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/ 解题思路:采用滑动窗口算法,在窗口内的字符串就是不重复子串,每次判断新的字符时,看窗口内是否存在该字符,如果存在,那么剔除并重新 阅读全文
摘要:
题目地址:https://leetcode-cn.com/problems/add-two-numbers/ 解题思路:简单链表操作,注意判断链表的长度以及最高位进位的情况。 值得注意的几组样例 >>>[5] >>>[5] >>>[1,8] >>>[0] >>>[9,8] >>>[1] >>>[1] 阅读全文
摘要:
题目地址:https://leetcode-cn.com/problems/two-sum/ 解题思路:因为数组中同一个元素不能使用两遍。我们可以使用map来进行排除。 所用到的函数: mp.count()//判断这个数是否存在 具体代码: class Solution { public: vect 阅读全文