码迷,mamicode.com
首页 >  
搜索关键字:leecode duplicates    ( 1908个结果
LeetCode Remove Duplicates from Sorted Array II
title  描述  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 no...
分类:其他好文   时间:2014-10-09 03:14:48    阅读次数:163
leetcode_1线性表_1数组_1&2Remove Duplicates from Sorted Array I & II
1.1.1 Remove Duplicates from Sorted Array题目:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the ...
分类:其他好文   时间:2014-10-08 14:20:45    阅读次数:229
Remove Duplicates from Sorted List I&&II
Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, r...
分类:其他好文   时间:2014-10-08 01:26:44    阅读次数:239
神小逻辑 Remove Duplicates from Sorted Array
/*put all vaild new array from the 0 to new length*/public class Solution { public int removeDuplicates(int[] A) { if(A.length < 2) ...
分类:其他好文   时间:2014-10-07 06:55:53    阅读次数:120
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. /** * Definition for binary tree * struct TreeNode { ...
分类:其他好文   时间:2014-10-06 14:46:30    阅读次数:202
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-10-06 14:45:50    阅读次数:178
Remove Duplicates from Sorted Array
class Solution { public: int removeDuplicates(int A[], int n) { int duplicate = 0; int i = 0; for(i = 0; i < n - 1; i++){ if(A[i] == A[i + 1]){ dupli...
分类:其他好文   时间:2014-10-05 22:23:09    阅读次数:183
Leetcode:remove_duplicates_from_sorted_list
给定一个排好序的链表,删除所有重复的节点,使每一个节点都只出现一次...
分类:其他好文   时间:2014-10-05 21:17:09    阅读次数:212
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!