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-...
分类:
其他好文 时间:
2014-07-07 16:17:00
阅读次数:
139
Problem Description:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?Solution: 1 public bo....
分类:
其他好文 时间:
2014-07-07 16:08:01
阅读次数:
151
题目:Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the ...
分类:
其他好文 时间:
2014-07-07 14:06:19
阅读次数:
221
题目:Linked List Cycle IIGiven a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it withou...
分类:
其他好文 时间:
2014-07-07 13:44:29
阅读次数:
281
Given a sorted linked list, delete all duplicates such that each element appear only once.
分类:
其他好文 时间:
2014-07-02 00:33:49
阅读次数:
204
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.
分类:
其他好文 时间:
2014-07-02 00:24:04
阅读次数:
284
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; *...
分类:
其他好文 时间:
2014-06-30 23:36:56
阅读次数:
211
题目
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a deep copy of the list.
方法
publi...
分类:
其他好文 时间:
2014-06-30 19:36:33
阅读次数:
163
题目
Given a binary tree, flatten it to a linked list in-place.
For example,
Given
1
/ 2 5
/ \ 3 4 6
The flattened tree should look lik...
分类:
其他好文 时间:
2014-06-30 18:13:31
阅读次数:
229
class Solution {public: ListNode *reverseBetween(ListNode *head, int m, int n) { if (head == NULL || n 0) { pre = cur; ...
分类:
其他好文 时间:
2014-06-30 15:36:26
阅读次数:
148