leecode刷题(23) 合并两个有序链表 合并两个有序链表 将两个有序链表合并为一个新的有序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 示例: 思路: 这道题我们可以用递归的方法来处理。首先我们可以设置一个临时头节点 head,当链表 l1 和链表 l2 不为空时,对它们进行比 ...
分类:
其他好文 时间:
2019-05-04 12:05:58
阅读次数:
99
leecode刷题(24) 翻转二叉树 翻转二叉树 翻转一棵二叉树。 示例: 输入: 输出: 备注: 这个问题是受到 "Max Howell " 的 "原问题" 启发的 : 谷歌:我们90%的工程师使用您编写的软件(Homebrew),但是您却无法在面试时在白板上写出翻转二叉树这道题,这太糟糕了。 ...
分类:
其他好文 时间:
2019-05-04 11:42:35
阅读次数:
142
80. Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length. Do not allocate e ...
分类:
其他好文 时间:
2019-05-01 18:34:11
阅读次数:
149
分析: Hi,I’m back~这个题一开始审错了,我以为字符串里就只有字母字符呢,其实任意字符都行,于是辅助空间从26改到256,还以为空间炸了,其实还好,名次还是很靠前的。 时间复杂度O(n),这个还是比较好的,也是拿空间换来的,思想就在注释里~ ...
分类:
其他好文 时间:
2019-05-01 16:10:54
阅读次数:
134
Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Example 2: ...
分类:
其他好文 时间:
2019-05-01 13:45:03
阅读次数:
153
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinctnumbers from the original list. Example 1: Example 2: ...
分类:
其他好文 时间:
2019-05-01 13:21:13
阅读次数:
123
Given a set of candidate numbers (`candidates`) (without duplicates) and a target number (`target`), find all unique combinations in `candidates` wh... ...
分类:
其他好文 时间:
2019-04-30 19:53:06
阅读次数:
151
Algorithm 本周的算法题是删除已排序数据中的重复数字(https://leetcode.com/problems/remove-duplicates-from-sorted-array/)。这道题比较简单,基本思路是从开头比较,遇到不同的数字,就进行替换 Reading 这周看的英文文章是《 ...
分类:
其他好文 时间:
2019-04-29 09:42:17
阅读次数:
117
https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/discuss/27976/3-6-easy-lines-C%2B%2B-Java-Python-Ruby 描述 Follow up for "Remove Du ...
分类:
编程语言 时间:
2019-04-27 09:25:45
阅读次数:
154