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.
For example:
Given the below binary tree and sum
...
分类:
其他好文 时间:
2014-10-02 18:26:13
阅读次数:
174
If you have a relatively small collection of key-values that you'd like to save, you should use the SharedPreferences APIs.
ASharedPreferences object
points to a file containing key-value pairs an...
分类:
其他好文 时间:
2014-10-01 02:51:10
阅读次数:
232
Key codes returned by Event.keyCode. These map directly to a physical key
on the keyboard.
KeyCode是由Event.keyCode返回的。这些直接映射到键盘上的物理键。
Values值
None
Not assigned (never is pressed)
未分配(永不被...
分类:
其他好文 时间:
2014-09-30 22:24:01
阅读次数:
367
最近在用cocos2dx 3.x版本做android版本的时候,出现点击工程-属性-C/C++ builder的时候会提示
The currently displayed paye contains invalid values
或者
An error has occurred. See error log for more details.
java.lang.NullPointerEx...
分类:
移动开发 时间:
2014-09-30 17:56:29
阅读次数:
227
我们一般会把界面上展示的颜色抽取到res/values/color中,这样方便的获取,也方便同意管理。
那么我们怎样获取color文件中的色值,并且给我iview设置背景的颜色呢。
第一种:
如果你在color中是这样写的,#eed776
那么在给view色值背景的时候,应该这样获取
view.setBackgroundColor(c...
分类:
其他好文 时间:
2014-09-30 16:49:19
阅读次数:
168
ContentValues :是一种存储机制,key-value
特点:key只能是string类型,value:只能是基本类型,不能是对象。
应用:常用语往数据库中插入数据
ContentValues values = new ContentValues();
values.put("name", "xh");
values.put("level", 5);
...
分类:
其他好文 时间:
2014-09-30 15:17:49
阅读次数:
204
有的时候做应用需要点击按钮时文字颜色也跟着变,松开后又还原,目前发现两种解决方案:第一用图片,如果出现的地方比较多,那么图片的量就相当可观;第二,也就是本文讲到的。废话少说,先贴图片,再上代码。正常效果:按下效果:先在values目录创建color.xml文件,在里面加入以下自定义颜色(注意不是用c...
分类:
移动开发 时间:
2014-09-29 19:58:52
阅读次数:
145
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 20
...
分类:
其他好文 时间:
2014-09-29 19:55:01
阅读次数:
169
table.keys
返回指定表格中的所有键。
格式:
keys = table.keys(表格对象)
用法示例:
local t = {a = 1, b = 2, c = 3}
local keys = table.keys(t)
-- keys = {"a", "b", "c"}
~~
table.values
返回指定表格中...
分类:
其他好文 时间:
2014-09-29 18:33:21
阅读次数:
407
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's.
去网上搜n个二叉搜索树的递推公式或者Catalan数,可以由h(n)=C(2n,n)/(n+1)得到h(n)=[2n*(2n-1)*...(n+2)]/[n!]....
分类:
其他好文 时间:
2014-09-29 17:57:01
阅读次数:
171