Given a linked list and a valuex, partition it
such that all nodes less thanxcome before nodes greater than or equal tox.You
should preserve the origi...
分类:
其他好文 时间:
2014-05-24 04:59:06
阅读次数:
275
Reverse digits of an integer. Example1: x =
123, return 321 Example2: x = -123, return –321 这道题应该不用详细说了。比较简单。唯一的是要注意特殊值0.
public class Solution { publ...
分类:
其他好文 时间:
2014-05-24 01:39:59
阅读次数:
170
Given a binary tree, find its maximum depth.The
maximum depth is the number of nodes along the longest path from the root node
down to the farthest le...
分类:
其他好文 时间:
2014-05-23 11:54:10
阅读次数:
317
题目链接题意:给出单链表头指针,要求交换链表中每一对相邻的结点.注意:不可以改变链表中结点的值,只可以使用常量空间.附上代码:
1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int
val;...
分类:
其他好文 时间:
2014-05-23 10:43:49
阅读次数:
249
戳我去解题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-05-20 08:52:09
阅读次数:
277
题目链接 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 si...
分类:
其他好文 时间:
2014-05-19 13:53:32
阅读次数:
296
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-05-19 12:05:23
阅读次数:
386
Leetcode 151题 Reverse Words in a String...
分类:
其他好文 时间:
2014-05-18 10:51:21
阅读次数:
243
Binary Tree Level Order Traversal
Total Accepted: 12441 Total
Submissions: 40879My Submissions
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left t...
分类:
其他好文 时间:
2014-05-18 10:11:13
阅读次数:
337
【题目】
Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space. You may not modify the values in the list, only nodes it...
分类:
其他好文 时间:
2014-05-18 08:37:57
阅读次数:
370