Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 25 下一页

2015年11月23日

摘要: 2D Segment Tree -> Quad Tree. class Node // 2D Segment Tree { public: Node(vector> &m, int ix0, int iy0, int ix1, int iy1) ... 阅读全文
posted @ 2015-11-23 06:43 Tonix 阅读(410) 评论(0) 推荐(0)

2015年11月22日

摘要: The most interesting, flexible and juicy binary tree problem I have ever seen.I learnt it from here: https://codepair.hackerrank.com/paper/5fIoGg74?b=... 阅读全文
posted @ 2015-11-22 12:51 Tonix 阅读(474) 评论(0) 推荐(0)

摘要: XOR -> 0 is the key (make it even pair): http://www.cnblogs.com/lautsie/p/3908006.htmlSomething to learn about basic Game Theory: http://www.cdf.toron... 阅读全文
posted @ 2015-11-22 11:56 Tonix 阅读(190) 评论(0) 推荐(0)

摘要: A typical game theory problem - Recursion + Memorized Searchhttp://justprogrammng.blogspot.com/2012/06/interviewstreet-challenges-permutation.html#.Vl... 阅读全文
posted @ 2015-11-22 10:34 Tonix 阅读(285) 评论(0) 推荐(0)

2015年11月21日

摘要: Same as LintCode "Sliding Window Median", but requires more care on details - no trailing zeroes.#include #include #include #include #include #include... 阅读全文
posted @ 2015-11-21 14:38 Tonix 阅读(225) 评论(0) 推荐(0)

摘要: Something to learn: Rotation ops in AVL tree does not require recursion.https://github.com/andreimaximov/hacker-rank/blob/master/data-structures/tree/... 阅读全文
posted @ 2015-11-21 13:42 Tonix 阅读(287) 评论(0) 推荐(0)

2015年11月19日

摘要: Something to learn:http://blog.csdn.net/yuwenshi/article/details/36666453Shortest Job First Algorithm - kinda greedy: we do shorter job first BUT we o... 阅读全文
posted @ 2015-11-19 07:20 Tonix 阅读(437) 评论(0) 推荐(0)

摘要: Regular Union-Find practice one.#include #include #include #include #include #include #include #include #include using namespace std;unordered_map ps;... 阅读全文
posted @ 2015-11-19 06:02 Tonix 阅读(306) 评论(0) 推荐(0)

摘要: Fenwick tree can do this job.class NumArray { vector in; vector ft; int query(int i) { i += 1; i = min(i, int(ft.size() - 1... 阅读全文
posted @ 2015-11-19 04:01 Tonix 阅读(262) 评论(0) 推荐(0)

摘要: A natural DFS thought. Several pruning tricks can be applied. Please take care of date type(long long).class Solution { bool _check(string a, strin... 阅读全文
posted @ 2015-11-19 03:08 Tonix 阅读(315) 评论(0) 推荐(0)

2015年11月17日

摘要: * Non-intuitive state designclass Solution {public: /** * @param A an integer array * @param k an integer * @return an integer */ ... 阅读全文
posted @ 2015-11-17 14:25 Tonix 阅读(729) 评论(0) 推荐(0)

2015年11月16日

摘要: DFS + Memorized Search (DP)class Solution { int dfs(int i, int j, int row, int col, vector>& A, vector>& dp) { if(dp[i][j] != 0) retu... 阅读全文
posted @ 2015-11-16 03:45 Tonix 阅读(270) 评论(0) 推荐(0)

2015年11月15日

摘要: https://codesolutiony.wordpress.com/2015/05/24/lintcode-coins-in-a-line-iii/A very juicy one! Deserve more consideration.class Solution {public: /*... 阅读全文
posted @ 2015-11-15 13:25 Tonix 阅读(297) 评论(0) 推荐(0)

2015年11月14日

摘要: Yes the accu* is not necessary :)class NumMatrix { vector> dp;public: NumMatrix(vector> &matrix) { int h = matrix.size(); if(!h) ret... 阅读全文
posted @ 2015-11-14 10:19 Tonix 阅读(118) 评论(0) 推荐(0)

摘要: Here is the thought flow: we are trying 'find' the boundary - it is a search, so binary search.class Solution { bool isRowHit(vector>& image, int r) ... 阅读全文
posted @ 2015-11-14 08:08 Tonix 阅读(223) 评论(0) 推荐(0)

2015年11月9日

摘要: Nice one to learn: DP + Game Theoryhttps://lefttree.gitbooks.io/leetcode/content/dynamicProgramming2/coinsInLine2.htmlIn game theory, we assume the ot... 阅读全文
posted @ 2015-11-09 12:57 Tonix 阅读(212) 评论(0) 推荐(0)

2015年11月6日

摘要: 1AC! Yes! Intuitive thought will be: we walk from up-left to down-right - but we should only walk along the 'lowest edge' in the sorted matrix - so it... 阅读全文
posted @ 2015-11-06 15:50 Tonix 阅读(264) 评论(0) 推荐(0)

2015年11月5日

摘要: DFS with pruning. The thought flow: for each char, we have 2 choices: pick or not - then DFS.class Solution { int len; unordered_set rec; vector ... 阅读全文
posted @ 2015-11-05 06:36 Tonix 阅读(328) 评论(0) 推荐(0)

2015年11月4日

摘要: Simply a variation to "Permutation Index". When calculating current digit index, we consider duplicated case.Again, similar as "Digit Counts", it is a... 阅读全文
posted @ 2015-11-04 08:56 Tonix 阅读(302) 评论(0) 推荐(0)

摘要: Lesson learnt: one effective solution for bit\digit counting problems: counting by digit\bithttp://www.hawstein.com/posts/20.4.htmlclass Solution {pub... 阅读全文
posted @ 2015-11-04 07:31 Tonix 阅读(221) 评论(0) 推荐(0)

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 25 下一页