码迷,mamicode.com
首页 >  
搜索关键字:duplicates    ( 1738个结果
leetcode Remove Duplicates from Sorted List
Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 很简单,先判断第一个位置否为空,不为空的话再判断下 个位置是否为空,如果都为空那么就不用操作了。 如果两...
分类:其他好文   时间:2014-10-05 20:16:08    阅读次数:202
Remove Duplicates from Sorted Array I&&II
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:其他好文   时间:2014-10-01 19:08:51    阅读次数:163
Remove Duplicates from Sorted Array
Follow up the "remove duplicates",what if duplicates are allowed at most twice?思路一:使用变量numlength记录数组中相同数字出现不超过两次所得到的数组长度;code:class Solution {public: ...
分类:其他好文   时间:2014-09-30 23:01:00    阅读次数:171
Construct Binary Tree from Preorder and Inorder Traversal<leetcode>
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题意:知道二叉树的前序遍历和中...
分类:其他好文   时间:2014-09-29 23:47:51    阅读次数:265
leetcode Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a...
分类:其他好文   时间:2014-09-26 19:48:18    阅读次数:182
Leetcode_num12_Search Insert Position
题目: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in t...
分类:其他好文   时间:2014-09-25 21:12:57    阅读次数:148
Leetcode_num11_Remove Duplicates from Sorted List
题目: Given a sorted linked list, delete all duplicates such that each element appear only once. 这道链表的题也比较简单,目标是为了去重,只是需要注意在去重的过程中需要使用while循环,使一个节点的下一个节点必须指向与其不同的节点 上代码咯 # Definition for singly-li...
分类:其他好文   时间:2014-09-25 18:39:57    阅读次数:193
[LeetCode][I]Permutations II
Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example, [1,1,2] have the following unique permutations: [1,1,2], [1,2,1], and [2,1,1]....
分类:其他好文   时间:2014-09-23 17:07:24    阅读次数:222
leetcode - Remove Duplicates from Sorted Array I && II
Remove Duplicates from Sorted Array IGiven a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new len...
分类:其他好文   时间:2014-09-21 14:50:00    阅读次数:209
Leetcode: Search in Rotated Sorted Array II
Follow up for "Search in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function ...
分类:其他好文   时间:2014-09-18 13:11:03    阅读次数:135
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!