码迷,mamicode.com
首页 >  
搜索关键字:leecode duplicates    ( 1908个结果
[LeetCode] Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.class Solutio...
分类:其他好文   时间:2014-08-04 23:57:18    阅读次数:476
Remove Duplicates from Sorted Array II leetcode java
题目: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 shou....
分类:编程语言   时间:2014-08-04 13:24:27    阅读次数:256
Remove Duplicates from Sorted Array
问题:将有序的数组中重复的数字去掉分析:由于有序所以只用和前一个比较就行class Solution {public: int removeDuplicates(int A[], int n) { int i,j; if(n==0 || n==1) return n...
分类:其他好文   时间:2014-08-03 17:42:35    阅读次数:204
LeetCode "Remove Duplicates from Sorted List II"
Corner cases!class Solution {public: ListNode *deleteDuplicates(ListNode *head) { if (!head) return head; if (!head->next) return hea...
分类:其他好文   时间:2014-08-03 07:51:34    阅读次数:237
Remove Duplicates from Sorted List
问题:将有序链表中的重复元素删除分析:由于有序,所以p结点是否重复只需要和它的前一节点比较是否相等就可以了,我们可以定义一个helper新头结点链表 将p结点与新链表的尾结点比较,若不相等则加入新链表中。class Solution{public: ListNode *deleteDup...
分类:其他好文   时间:2014-08-02 17:47:33    阅读次数:210
[leetcode笔记] Remove Duplicates from Sorted List II
问题描述:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->...
分类:其他好文   时间:2014-08-02 01:33:12    阅读次数:249
【LeetCode】Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the tree. /** * Definition for binary tree * struct TreeNode {...
分类:其他好文   时间:2014-08-01 19:53:32    阅读次数:222
Construct Binary Tree from Inorder and Postorder Traversal Traversal leetcode java
题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题解:这道题跟pre....
分类:编程语言   时间:2014-08-01 06:56:51    阅读次数:185
Construct Binary Tree from Preorder and Inorder Traversal leetcode java
题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题解: 1 ...
分类:编程语言   时间:2014-08-01 06:56:41    阅读次数:228
Leetcode--Remove Duplicates from Sorted Array
Problem Description: 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 ...
分类:其他好文   时间:2014-08-01 00:08:50    阅读次数:274
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!