Problem Description:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Solution: 递归。 1 public List>...
分类:
其他好文 时间:
2014-07-07 16:59:12
阅读次数:
169
Assert.assertEquals("发生错误时报告消息","预期值","生产值"); Assert.assertEquals("精确两位小数点",3.33,10.0/3.0,0.01); Assert.assertNotNull("");//验证是否为非空 ...
分类:
其他好文 时间:
2014-07-07 08:17:40
阅读次数:
168
在前面的文章C#相等性比较和C#排序比较中,我已经叙述了类型相等,类型哈希,和类型比较的.NET标准协议。实现了这些协议的类型在一个字典或者列表中也可以正常工作。但是需要注意的是: 只有当类型的Equals方法和GetHashCode方法返回有意义的结果时,该类型才可以作为Dictionary或H....
分类:
其他好文 时间:
2014-07-03 21:33:16
阅读次数:
560
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
分类:
其他好文 时间:
2014-07-03 13:02:23
阅读次数:
200
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:
其他好文 时间:
2014-07-02 22:34:44
阅读次数:
318
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:
其他好文 时间:
2014-07-02 22:10:42
阅读次数:
262
覆盖equals时,遵守通用约定
对equal方法的覆盖看起来很简单,但是有许多情况是容易导致错误,最好的避免这些错误的办法
就是不覆盖equals方法.
必须遵循的原则:
自反性--对于任何非空的引用 x,有x.equals(x) 为true;
对称性--对于任何非空的引用x,y,如果x.equals(y) 为true,则必有y.equals(x) 为true;
传递...
分类:
其他好文 时间:
2014-07-02 17:03:19
阅读次数:
142
String 内容定义成 final char[],只能在属性和构造函数中赋值,其它地方不能改变 ;String 覆盖实现了 equals 。StringBuffer 内容定义成了 char[] ,但没实现 equals。String 和 StringBuffer 的区别是:1、String 通过构...
分类:
编程语言 时间:
2014-07-01 23:32:09
阅读次数:
266
上回书说道:灰常灰常基本的数据类型
下面咱们来点高级的:
Tuples 元组
元组存储一对键值,并且没有类型限制
let http404Error = (404, "Not Found")
// http404Error is of type (Int, String), and equals (404, "Not Found")书上废话一堆,反正元组就是这么写,上面的例子还...
分类:
其他好文 时间:
2014-07-01 06:55:09
阅读次数:
236