摘要: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...
阅读全文
12 2015 档案
摘要:https://leetcode.com/discuss/75014/math-solutionLesson learnt: dig deeper!
阅读全文
摘要: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...
阅读全文
摘要:What a classic DP problem..https://leetcode.com/discuss/72216/share-some-analysis-and-explanations
阅读全文
摘要: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 ...
阅读全文
摘要:Almost identical to LintCode "Count of Smaller Number before Self". Corner case needs to be taken care of.class Solution { ////////////////// //...
阅读全文
摘要:BFS + HashTableclass Solution { int maxl, minl; unordered_map> hm;public: vector> verticalOrder(TreeNode* root) { maxl = INT_MIN; ...
阅读全文

浙公网安备 33010602011771号