码迷,mamicode.com
首页 >  
搜索关键字:leecode duplicates    ( 1908个结果
[leetcode]
问题描述: Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 基本思路: 与前一篇《Construct Binary Tree from Preord...
分类:其他好文   时间:2014-11-23 11:51:28    阅读次数:172
[leetcode]Construct Binary Tree from Preorder and Inorder Traversal
问题描述: Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. 基本思路: 找到规律,递归的解决左子树和右子树。 代码: /** * D...
分类:其他好文   时间:2014-11-23 10:32:58    阅读次数:190
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 perm...
分类:其他好文   时间:2014-11-22 20:11:58    阅读次数:180
[leetcode] 13. Remove Duplicates from Sorted List
这个题目其实不难的,主要是我C++的水平太差了,链表那里绊了好久,但是又不像用python,所以还是强行上了。 题目如下: Given a sorted linked list, delete all duplicates such that each element appear only onc...
分类:其他好文   时间:2014-11-22 17:16:55    阅读次数:177
Leetcode: Find Minimum in Rotated Sorted Array II
Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?前面那道题:Find ...
分类:其他好文   时间:2014-11-22 11:59:28    阅读次数:162
Leetcode-Find Minimum in Rotated Sorted Array II
Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose a s...
分类:其他好文   时间:2014-11-22 07:03:46    阅读次数:206
LeetCode Remove Duplicates from Sorted Array删除整型数组中的重复元素并返回剩下元素个数
1 class Solution { 2 public: 3 int removeDuplicates(int A[], int n) { 4 int *s=&A[0],*e=&A[0]; //s指向开头第一个,e往后遍历相同的 5 int t,i,j=n; 6 fo...
分类:编程语言   时间:2014-11-22 00:40:25    阅读次数:215
Subsets II
Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descending order....
分类:其他好文   时间:2014-11-21 14:03:57    阅读次数:160
Remove Duplicates from Sorted Array II
Follow up for "Remove Duplicates": What if duplicates are allowed at most twice? For example, Given sorted array A = [1,1,1,2,2,3], Your function should return length = 5, and A is now [1,1,2,...
分类:其他好文   时间:2014-11-20 17:07:45    阅读次数:194
Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with...
分类:其他好文   时间:2014-11-20 17:07:03    阅读次数:218
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!