Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2] have the following unique pe...
分类:
其他好文 时间:
2014-11-20 13:39:43
阅读次数:
108
问题描述:
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
[...
分类:
其他好文 时间:
2014-11-19 22:19:08
阅读次数:
138
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.
思路很简单,由于乖乖的sort好了,就是判断下...
分类:
编程语言 时间:
2014-11-19 18:51:28
阅读次数:
242
Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ret...
分类:
其他好文 时间:
2014-11-19 14:01:24
阅读次数:
134
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), ne...
分类:
其他好文 时间:
2014-11-19 13:51:14
阅读次数:
222
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-...
分类:
其他好文 时间:
2014-11-19 07:18:17
阅读次数:
236
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.The solution set must not contain dupli...
分类:
其他好文 时间:
2014-11-19 01:33:20
阅读次数:
217
给定一个链表,去除重复的值,每个数字只出现一次,例如Given1->1->2, return1->2.Given1->1->2->3->3, return1->2->3.思路:用pre记录合法链表的最后一个,now为第二个节点一直往后走,如果now的值不等于pre那么更新pre为now,now继续往...
分类:
其他好文 时间:
2014-11-18 23:44:34
阅读次数:
307
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-...
分类:
其他好文 时间:
2014-11-18 06:58:19
阅读次数:
145
给定一个有序链表,删除相同值的节点。例如Given1->2->3->3->4->4->5, return1->2->5.Given1->1->1->2->3, return2->3.我是新建一个ans链表,来存链表中distinct的值。不知道这样符合要求不。判断当前的值不等于前面一个也不等于后面一...
分类:
其他好文 时间:
2014-11-18 01:38:12
阅读次数:
134