题目描述:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".解决方案:该题目解决思路很简单,新建一个字符串,然...
分类:
其他好文 时间:
2014-09-24 23:25:27
阅读次数:
171
Given a binary tree, return thepostordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].思路...
分类:
其他好文 时间:
2014-09-24 22:57:37
阅读次数:
187
#include #include #include char* Reverse(char* s){//将q指向字符串最后一个字符 char* q = s ;while( *q++ ) ; q -= 2 ; //分配空间,存储逆序后的字符串。 char* p = (char *)malloc(siz...
分类:
其他好文 时间:
2014-09-24 19:25:17
阅读次数:
191
#include #include //注意这种实现方法,unsigned Reverse( unsigned a ){ unsigned b = 0; for( ; a; a/=10 ) { b = b*10 + a%10; } return b;}int main(void){int a = 2...
分类:
其他好文 时间:
2014-09-24 18:36:07
阅读次数:
153
【求最大深度】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 leaf node.
这里说的最大深度是指最深叶子节点到根节点的路径长度
...
分类:
其他好文 时间:
2014-09-24 16:09:37
阅读次数:
200
题目:Given a binary tree, return the preorder traversal
of its nodes' values.
此题即为二叉树的前序遍历,递归的方法很简单:先节点再左子树再右子树;迭代的方法可以利用栈存储来完成遍历过程。
补充递归与迭代的区别:许多问题是以递归的形式进行解释的,这只是因为它比非递归形式更为清晰。但是,这些问题的迭代往往比递归实现效率更...
分类:
其他好文 时间:
2014-09-24 11:24:56
阅读次数:
206
原题:
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9 ...
分类:
其他好文 时间:
2014-09-23 20:29:17
阅读次数:
243
reverse-double-linked-list
分类:
编程语言 时间:
2014-09-23 19:27:55
阅读次数:
284
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321 1 public class Solution { 2 public int reverse(int x) { 3 ...
分类:
编程语言 时间:
2014-09-23 12:10:24
阅读次数:
235
需要使用的是jsoup-1.7.3.jar包 如果需要看文档我下载请借一步到官网:http://jsoup.org/
这里贴一下我用到的 Java工程的测试代码
package com.javen.Jsoup;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Docu...
分类:
Web程序 时间:
2014-09-22 22:57:33
阅读次数:
295