Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

12 2015 档案

摘要:Nothing magic here. Just BFS, but - BFS from land is not a good idea - BFS from Buildings.Lesson learnt: reverse thinking helps!class Solution {public... 阅读全文
posted @ 2015-12-22 07:22 Tonix 阅读(333) 评论(0) 推荐(0)

摘要:https://leetcode.com/discuss/75014/math-solutionLesson learnt: dig deeper! 阅读全文
posted @ 2015-12-19 15:18 Tonix 阅读(160) 评论(0) 推荐(0)

摘要:Another O(n^2) solution using bit ops. We prune 1/2(expected) candidates at each bit check.#define MAX_BITS 1600typedef bitset CandMask;class Solution... 阅读全文
posted @ 2015-12-17 04:16 Tonix 阅读(264) 评论(0) 推荐(0)

摘要:What a classic DP problem..https://leetcode.com/discuss/72216/share-some-analysis-and-explanations 阅读全文
posted @ 2015-12-16 14:09 Tonix 阅读(153) 评论(0) 推荐(0)

摘要:A classic type of problem: multi-pointer marching algorithm. For each pointer of each prime, we need to remember where it is in the ugly sequence, so ... 阅读全文
posted @ 2015-12-16 04:35 Tonix 阅读(188) 评论(0) 推荐(0)

摘要:Almost identical to LintCode "Count of Smaller Number before Self". Corner case needs to be taken care of.class Solution { ////////////////// //... 阅读全文
posted @ 2015-12-15 13:55 Tonix 阅读(178) 评论(0) 推荐(0)

摘要:BFS + HashTableclass Solution { int maxl, minl; unordered_map> hm;public: vector> verticalOrder(TreeNode* root) { maxl = INT_MIN; ... 阅读全文
posted @ 2015-12-15 12:26 Tonix 阅读(149) 评论(0) 推荐(0)