Monthly Archives: October 2015


Learning Note for Functional Programming

Coursera Note Sentence in red is my own perspective, inspired by the instructor. 1.1 Programming Paradigms Imperative Programs and Computers There is strong correspondence between Mutable variables ~ Memory cells Variable dereference ~ load instructions Variable assignments ~ store instructions Control structures ~ jumps Problem: how can we avoid conceptualizing […]


Jetty Hello World教程 2

关于如何在命令行下run一个Hello world的jetty程序。 首先下载两个依赖包 http://mvnrepository.com/artifact/javax.servlet/servlet-api/2.5 http://mvnrepository.com/artifact/org.eclipse.jetty.aggregate/jetty-all/7.0.2.v20100331 将它们放在一个文件夹下,然后新建一个HelloWorld.java的文件,填入如下代码:

完成之后的文件夹是这个样子的^ ^ 然后进入命令行,把工作路径切到该目录下。(我是用的git命令行) 然后输入编译命令,根据操作系统不同,你的MAC上可能要把分号’;’改成冒号’:’,并且可能不用加引号。

  编译成功后,文件夹出现HelloWorld.class的字节文件。 然后运行执行命令,(同理,MAC上可能得更改格式,分号变冒号)

服务器就跑起来了,在浏览器中输入

就会看到程序成功执行的字样。 但是这只是一个简单例子,如果工程较大的话,还得用eclipse+maven管理会方便些。  


[leetcode] Count Univalue Subtrees

Count Univalue Subtrees Given a binary tree, count the number of uni-value subtrees. A Uni-value subtree means all nodes of the subtree have the same value. For example: Given binary tree,

return 4.