2013年6月4日
摘要: // 136ms 过大的 1 int f[100][11000]; 2 class Solution { 3 public: 4 int numDistinct(string S, string T) { 5 // Start typing your C/C++ solution below 6 // DO NOT write int main() function 7 memset(f,0,100*11000); 8 9 int i,j;10 const char *s=S.c_st... 阅读全文
posted @ 2013-06-04 16:40 宇睿 阅读(124) 评论(0) 推荐(0) 编辑
摘要: // 64ms 过大的 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : val(x), left(NULL), right(NULL) {} 8 * }; 9 */10 class Solution {11 public:12 bool reVal(int minLeft,TreeNode *root,int maxR... 阅读全文
posted @ 2013-06-04 12:40 宇睿 阅读(157) 评论(0) 推荐(0) 编辑
摘要: // 先分析 拆成三段 16ms 过大的 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next; 6 * ListNode(int x) : val(x), next(NULL) {} 7 * }; 8 */ 9 class Solution {10 public:11 ListNode *reverseBetween(ListNode *head, int m, int n) {12 ... 阅读全文
posted @ 2013-06-04 12:09 宇睿 阅读(218) 评论(0) 推荐(0) 编辑
摘要: // 156ms 过大的 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : val(x), left(NULL), right(NULL) {} 8 * }; 9 */10 class Solution {11 public:12 13 TreeNode *buildTree(vector<int> &preorder,i... 阅读全文
posted @ 2013-06-04 11:03 宇睿 阅读(150) 评论(0) 推荐(0) 编辑