Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value t...
分类:
其他好文 时间:
2014-07-18 20:00:41
阅读次数:
205
The key of this problem is about details especially boundary conditions.class Solution {public: ListNode *deleteDuplicates(ListNode *head) { ...
分类:
其他好文 时间:
2014-07-18 14:36:54
阅读次数:
189
public class Solution { public void merge(int A[], int m, int B[], int n) { int a=m-1; int b=n-1; int index=m+n-1; whil...
分类:
其他好文 时间:
2014-07-18 12:06:55
阅读次数:
147
Sorting It All Out
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 26866
Accepted: 9267
Description
An ascending sorted sequence of distinct values...
分类:
其他好文 时间:
2014-07-18 11:33:31
阅读次数:
294
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-07-17 22:24:40
阅读次数:
216
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l...
分类:
其他好文 时间:
2014-07-17 18:09:32
阅读次数:
258
1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next; 6 * ListNode(int x) { 7 * ...
分类:
编程语言 时间:
2014-07-16 17:45:41
阅读次数:
226
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
For example,
Given 1->2->3->3->4->4->5, return 1->2->5.
Given 1->1-...
分类:
其他好文 时间:
2014-07-16 17:30:52
阅读次数:
230
Repost from:http://blog.csdn.net/yutianzuijin/article/details/11499917这是我做的第二个leetcode题目,一开始以为和第一个一样很简单,但是做的过程中才发现这个题目非常难,给人一种“刚上战场就踩上地雷挂掉了”的感觉。后来搜了一下...
分类:
其他好文 时间:
2014-07-16 15:19:06
阅读次数:
244
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.#include#includeusing namespace std;struct ListNode ...
分类:
其他好文 时间:
2014-07-16 15:17:03
阅读次数:
188