摘要: 1.Largest Rectangle in Histogramhttp://discuss.leetcode.com/questions/259/largest-rectangle-in-histogramhttp://www.cnblogs.com/remlostime/archive/2012/11/25/2787359.html2.Minimum Window Substringhttp://discuss.leetcode.com/questions/97/minimum-window-substringhttp://www.cnblogs.com/remlostime/archiv 阅读全文
posted @ 2013-09-05 19:23 代码改变未来 阅读(195) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: bool isScramble(string s1, string s2) { int n = s1.size(); if (s2.size() != n) return false; bool f[n][n][n]; for (int i=0; i<n; i++) for (int j=0; j<n; j++) f[i][j][0] = s1[i] == s2[j]; for (int l=1; l<n; l++) ... 阅读全文
posted @ 2013-09-05 19:08 代码改变未来 阅读(260) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public ArrayList generateTrees(int n) { return generateTrees(1, n); } public ArrayList generateTrees(int start, int end){ ArrayList unique = new ArrayList(); if(start > end){ unique.add(null); return unique; } ... 阅读全文
posted @ 2013-09-05 19:03 代码改变未来 阅读(1315) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: int calLen(ListNode *node) { int len = 0; while(node) { len++; node = node->next; } return len; } TreeNode *createTree(ListNode *node, int left, int right) { if (left > right) return NU... 阅读全文
posted @ 2013-09-05 18:42 代码改变未来 阅读(280) 评论(0) 推荐(0) 编辑
摘要: class Solution {public: int trap(int A[], int n) { if(n==0)return 0; vectorleft(n); int maxHeight = 0; for(int i = 0; i right(n); maxHeight = 0; for(int i = n - 1; i >= 0; i--) { right[i] = maxHeight; maxHeight = max(maxHeigh... 阅读全文
posted @ 2013-09-05 15:39 代码改变未来 阅读(245) 评论(0) 推荐(0) 编辑