[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
分析: 不给说O(n)时间复杂度,O(1)空间复杂度,我还真想不到这么好的。 ...
分类:
编程语言 时间:
2019-04-17 16:41:13
阅读次数:
180
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
分析: 写的太丑了,不如人家写的好,只能借鉴别人的。要学的东西好多啊。 ...
分类:
其他好文 时间:
2019-04-15 16:30:49
阅读次数:
164
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