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
[LeetCode] Remove Duplicates from Sorted Array 有序数组中去除重复项 描述 Given a sorted array nums, remove the duplicates in-place such that each element appear o ...
分类:
编程语言 时间:
2019-04-27 00:51:03
阅读次数:
152
描述 Given a sorted linked list, delete all duplicates such that each element appear only once. Example 1: Input: 1->1->2Output: 1->2Example 2: Input: 1 ...
分类:
编程语言 时间:
2019-04-27 00:30:34
阅读次数:
149
[TOC] 题目描述: 给定一个排序数组,你需要在 "原地" 删除重复出现的元素,使得每个元素最多出现两次,返回移除后数组的新长度。 不要使用额外的数组空间,你必须在 "原地" 修改输入数组 并在使用 O(1) 额外空间的条件下完成。 示例 1: 示例 2: 说明: 为什么返回数值是整数,但输出的答 ...
分类:
编程语言 时间:
2019-04-26 11:01:52
阅读次数:
137
Algorithm 题目描述 Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least t ...
分类:
其他好文 时间:
2019-04-21 12:46:02
阅读次数:
185
两个题类似,第一个题是不允许有重复的数字,第二个题是允许每个数字最多重复两个,两个题目都要求在原数组上进行操作,并返回生成数组的长度,即空间复杂度为O(1)。 两个题都是使用双指针,第一个指针指向生成新的数组的最后一个位置,第二个指针指向当前进行判断的位置。 唯一不同的是, 第二个题需要设置一个变量 ...
分类:
其他好文 时间:
2019-04-18 14:58:31
阅读次数:
128
Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. For example, ...
分类:
编程语言 时间:
2019-04-15 23:23:39
阅读次数:
214
Given a collection of integers that might contain duplicates, nums, return all possible subsets (the power set). Note: The solution set must not conta ...
分类:
其他好文 时间:
2019-04-11 10:41:08
阅读次数:
141
```
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class ... ...
分类:
其他好文 时间:
2019-04-09 12:32:43
阅读次数:
152
```
class Solution {
public: ListNode *deleteDuplicates(ListNode *head) { if (!head || !head->next) return head; ListNode *dummy = new ListNode(-1), *... ...
分类:
其他好文 时间:
2019-04-09 12:25:36
阅读次数:
95