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 fir...
分类:
其他好文 时间:
2014-07-22 22:51:35
阅读次数:
146
1、思路:将字符串转化为字符串数组,然后根据下标反向输出 public?void?reverse()?{
String?s?=?"hello";
char[]?c;
c?=?s.toCharArray();??//转化为字符串数组
for?(int?i?=?c.length?...
分类:
其他好文 时间:
2014-07-22 09:10:36
阅读次数:
446
Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the or...
分类:
其他好文 时间:
2014-07-21 09:33:03
阅读次数:
218
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-07-21 09:07:24
阅读次数:
207
Partition ListGiven a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should pres...
分类:
其他好文 时间:
2014-07-21 08:28:54
阅读次数:
230
public class Solution { public String reverseWords(String s) { String ans=reverse(s); String s2[]=ans.split("\\s+"); ...
分类:
其他好文 时间:
2014-07-21 08:20:33
阅读次数:
203
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given binary...
分类:
其他好文 时间:
2014-07-20 22:41:23
阅读次数:
303
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
click to show spoilers.
Have you thought about this?
Here are some good questions to ask before c...
分类:
编程语言 时间:
2014-07-20 22:12:03
阅读次数:
251
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
比较两个...
分类:
编程语言 时间:
2014-07-20 22:12:03
阅读次数:
273
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-07-20 21:32:55
阅读次数:
250