摘要:
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 阅读全文
摘要:
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++) ... 阅读全文
摘要:
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; } ... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文