上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页
摘要: class Solution { public: int findNumberOfLIS(vector& nums) { if (nums.size() == 0) return 0; pair res = {0, 0}; // vector> dp(nums.size(), {1,1}); // pair: length, cou... 阅读全文
posted @ 2018-06-01 15:56 JTechRoad 阅读(78) 评论(0) 推荐(0) 编辑
摘要: slow: faster: 阅读全文
posted @ 2018-06-01 15:55 JTechRoad 阅读(106) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ cla... 阅读全文
posted @ 2018-06-01 13:50 JTechRoad 阅读(88) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int numDecodings(string s) { int n = s.length(); if (n == 0) return 0; vector dp(n+1, 0); dp[0] = 1; for (int i = 0; i 0) { ... 阅读全文
posted @ 2018-06-01 13:33 JTechRoad 阅读(153) 评论(0) 推荐(0) 编辑
摘要: // TODO: need improve!!! class Log { public: int id; bool start; int timestamp; int comp; // compasation Log() { id = 0; timestamp = 0; comp = 0; ... 阅读全文
posted @ 2018-05-30 15:11 JTechRoad 阅读(162) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int leastInterval(vector& tasks, int n) { int freq[26] = {0}; for (auto t : tasks) { freq[t-'A']++; } int max_freq = 0, max_fr... 阅读全文
posted @ 2018-05-30 14:24 JTechRoad 阅读(87) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ cla... 阅读全文
posted @ 2018-05-30 13:55 JTechRoad 阅读(84) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: int leastBricks(vector>& wall) { unordered_map m; for (int i = 0; i < wall.size(); i++) for (int j = 0, t = 0; j < wall[i].size() - 1; j++) { ... 阅读全文
posted @ 2018-05-30 13:34 JTechRoad 阅读(80) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ cla... 阅读全文
posted @ 2018-05-29 23:33 JTechRoad 阅读(67) 评论(0) 推荐(0) 编辑
摘要: class Solution { public: long max_id = 0; unordered_map id_long; // Encodes a URL to a shortened URL. string encode(string longUrl) { id_long[max_id++] = longUrl; ... 阅读全文
posted @ 2018-05-29 23:25 JTechRoad 阅读(98) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页