- 博客(9)
- 收藏
- 关注
原创 cc150 4.1
check if a tree is balancedpublic int getHeight (TreeNode root) { if (root == null) return 0; return Math.max(getHeight (root.left), getHeight(root.right)) + 1;}public boolean
2015-01-30 13:12:04
554
原创 Count and say
public class Solution { public String countAndSay(int n) { if (n return null; } int num = 1; String s = "1"; for (int i = 0; i
2014-10-16 11:27:31
347
原创 Subsets - leescode
Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For exa
2014-10-15 08:51:41
307
转载 Subset
Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For exa
2014-10-15 08:39:22
435
原创 Unique Path 2 - leetcode
Unique Paths II Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and
2014-10-15 05:49:53
352
原创 Flatten binary tree to linkedlist - leetcode
Flatten Binary Tree to Linked ListGiven a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The fl
2014-10-15 04:27:51
362
原创 Valid parentheses - leetcode
Valid parentheses思路:code:publicclass Solution { public boolean isValid(String s) { if (s.length() == 0 || s.length() == 1) { return false; }
2014-10-14 04:49:46
286
原创 Valid parentheses
Valid Parentheses Total Accepted: 21159 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in t
2014-10-14 04:21:24
289
转载 wrap_content 和fill_parent
Android fill_parent、wrap_content和match_parent的区别(别处抄来zuo'b)三个属性都用来适应视图的水平或垂直大小,一个以视图的内容或尺寸为基础的布局比精确地指定视图范围更加方便。1)fill_parent设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间。这跟Wi
2014-08-10 04:32:21
550
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人