摘要: We may meet the case that we wanna pop the leftViewController programmatically in the landscape mode. One way to do thisUIBarButtonItem *masterButton = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleBordered target:self.splitViewController action:@selector(toggleM 阅读全文
posted @ 2014-02-28 00:15 Tooood 阅读(455) 评论(0) 推荐(0)
摘要: Algorithm : DP;public class Solution{ public int minimumTotal(ArrayList> triangle) { for(int i = triangle.size()-2; i>=0;i--) { ArrayList a1 = triangle.get(i); ArrayList nextLevel = triangle.get(i+1); for(int j = 0; j<a1.size();j++) { int sum2=0,sum3=0; sum2 = a1.get(j) + nextLevel.get(j); 阅读全文
posted @ 2014-02-04 04:21 Tooood 阅读(199) 评论(0) 推荐(0)
摘要: For example, givenn= 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()"解法:leetcode上的解法很赞。 其实这也是利用的递归的分支。构建了一树状结构并遍历,叶子节点就是valid的结果。 1 public static ArrayList generateParenthesis(int n) { 2 // Start typing your Java solution below 3 阅读全文
posted @ 2014-02-04 02:56 Tooood 阅读(149) 评论(0) 推荐(0)
摘要: Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to buy one share of the stock and sell one share of the stock, design an algorithm to find the best times to buy and sell.The question is equivalent to the following:Find i and j that ma 阅读全文
posted @ 2013-12-29 11:38 Tooood 阅读(176) 评论(0) 推荐(0)