题目:Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2...
分类:
其他好文 时间:
2014-07-10 14:29:45
阅读次数:
259
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
分类:
其他好文 时间:
2014-07-10 00:18:17
阅读次数:
278
题目:Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After rem...
分类:
其他好文 时间:
2014-07-07 19:01:42
阅读次数:
155
Problem Description:Given a binary tree, flatten it to a linked list in-place.Solution:对二叉树进行前序遍历(pre-order). 1 public void flatten(TreeNode root) { 2...
分类:
其他好文 时间:
2014-07-07 18:47:24
阅读次数:
306
【问题】
Sort a linked list in O(n log n)
time using constant space complexity.
【代码】
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# ...
分类:
编程语言 时间:
2014-06-28 08:29:23
阅读次数:
222
【问题】
Sort a linked list using insertion sort.
【代码】
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Sol...
分类:
编程语言 时间:
2014-06-28 07:55:49
阅读次数:
199
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
分类:
其他好文 时间:
2014-06-27 12:29:18
阅读次数:
294
Given a linked list, remove the nth node from the end of list and return its head.
分类:
其他好文 时间:
2014-06-27 12:26:10
阅读次数:
322
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2014-06-27 12:21:24
阅读次数:
215
题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sing...
分类:
其他好文 时间:
2014-06-27 11:38:12
阅读次数:
207