摘要:
Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1... 阅读全文
摘要:
Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",return["255.2... 阅读全文
摘要:
message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message contain... 阅读全文
摘要:
题目:Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representat... 阅读全文
摘要:
complete tree,except possibly the last, is completely filled, and all nodes in the last level are as far left as possible.from wiki本来在考虑最底层到底满不满,发现是通过... 阅读全文
摘要:
来说说看问题急躁,一开始就理所当然的想问的是overlapped area,实际上是total。脑子里一堆边界条件,看了ref觉得很简洁http://blog.csdn.net/foreverling/article/details/46411069public class Solution { ... 阅读全文
摘要:
典型的dfs题,建议在其他dfs之前做public class Solution { public ArrayList> combine(int n, int k) { ArrayList> res = new ArrayList>(); if(nn) return... 阅读全文
摘要:
public class Solution { public int minDistance(String word1, String word2) { if(word1==null||word1.length()==0) return word2.length(); ... 阅读全文
摘要:
几个corner cases要清楚refhttp://www.cnblogs.com/springfor/p/3869666.html引用一个用法注意“判断字符串相等与否要用.equals(),因为是引用类型。要注意split函数是可以split出空字符的,例如://b/ 会被split结果为[""... 阅读全文
摘要:
public class Solution { public int climbStairs(int n) { int[] res =new int[n+3]; // 因为如果n<3,至少希望把前三个位置做出来 res[0] = 0; res[1]... 阅读全文