最近找工作,免不了看CC150 刷 LeetCode 来练手,练习之余也向各路大神 系统并且深入的学习、巩固一下算法知识。一. 线性表1. 数组 Remove Duplicates from Sorted Array Remove Duplicates from Sorted Array II .....
分类:
其他好文 时间:
2014-09-10 08:21:50
阅读次数:
246
Problem Description:
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 se...
分类:
其他好文 时间:
2014-09-09 21:35:29
阅读次数:
281
Problem Description:
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...
分类:
其他好文 时间:
2014-09-09 16:17:29
阅读次数:
200
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-09-09 12:23:58
阅读次数:
176
觉着自己写的比看到的答案精简,分享一下:
class Solution {
public:
ListNode *deleteDuplicates(ListNode *head) {
if(head == NULL) return NULL;
ListNode res(-1);
ListNode* pre = &res;
pr...
分类:
其他好文 时间:
2014-09-08 01:03:16
阅读次数:
267
Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2] have the following unique per...
分类:
其他好文 时间:
2014-09-08 00:55:26
阅读次数:
269
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-09-06 07:32:22
阅读次数:
239
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-...
分类:
其他好文 时间:
2014-09-05 05:31:40
阅读次数:
176
Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
分类:
其他好文 时间:
2014-09-05 05:31:30
阅读次数:
224
487-3279是一种转化题,按照题目要求将输入转化为规定的格式,再按照某种格式输出。本题的要求:将输入的一个字符串按照如下转化规则进行转化,并判断转化后是否有相同的字符串,若有则输出该字符串及出现的次数,如没有则输出No duplicates.转化规则:A, B, and C map to 2D,...
分类:
其他好文 时间:
2014-09-04 18:30:39
阅读次数:
285