Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
上一页 1 2 3 4 5 6 ··· 25 下一页

2017年12月29日

摘要: DFS + memo. 阅读全文
posted @ 2017-12-29 09:09 Tonix 阅读(237) 评论(0) 推荐(0) 编辑

摘要: Actually, it is a Greedy problem : ) 阅读全文
posted @ 2017-12-29 08:45 Tonix 阅读(130) 评论(0) 推荐(0) 编辑

2017年12月28日

摘要: It is marked as Recursion on HR, but the optimal solution is DP. Step by step, discover internal mechanism. 阅读全文
posted @ 2017-12-28 13:45 Tonix 阅读(138) 评论(0) 推荐(0) 编辑

2017年12月27日

摘要: The trick of this problem is.. Adding 1+ coins to one pile, means nothing - you add one, then i just remove it.. so it is back to original game. So, b 阅读全文
posted @ 2017-12-27 12:29 Tonix 阅读(129) 评论(0) 推荐(0) 编辑

摘要: A simple NIM game in disguise: move 1 coin to one of previous slot, equals to removing.. Then no surprise, Sprague-Grundy theorem solves the problem. 阅读全文
posted @ 2017-12-27 11:55 Tonix 阅读(152) 评论(0) 推荐(0) 编辑

摘要: Another easy one solved by Sprague-Grundy theorem. Each pile is a sub-game, so you need to XOR SG value of all substates - since you can move # of 1 - 阅读全文
posted @ 2017-12-27 11:37 Tonix 阅读(141) 评论(0) 推荐(0) 编辑

摘要: A matter of OBSERVATION.. draw a triangle of parity, and watch. 阅读全文
posted @ 2017-12-27 08:46 Tonix 阅读(104) 评论(0) 推荐(0) 编辑

2017年12月26日

摘要: Discrete thinking - Play & Observe! " you can move numbers in any quadrant at the following positions to [x][y]: [x][y] or // upper left quadrant [x][ 阅读全文
posted @ 2017-12-26 13:43 Tonix 阅读(185) 评论(0) 推荐(0) 编辑

摘要: Another intuitive of application of Sprague-Grundy theorem. 阅读全文
posted @ 2017-12-26 13:18 Tonix 阅读(198) 评论(0) 推荐(0) 编辑

摘要: An intuitive problem for learning & applying Sprague-Grudy theorem: https://zhuanlan.zhihu.com/maigo/20611132 Lesson learnt, in Sprague-Grundy theorem 阅读全文
posted @ 2017-12-26 11:12 Tonix 阅读(210) 评论(0) 推荐(0) 编辑

2017年12月25日

摘要: The major trick is from another similar HR problem: subarray with max XOR: Build a binary tree bit by bit, and go from MSB to LSB, greedily. In this o 阅读全文
posted @ 2017-12-25 12:13 Tonix 阅读(241) 评论(0) 推荐(0) 编辑

2017年12月23日

摘要: Fun Greedy. My first thought was a DFS based solution... however the editorial provides a super neat 2-pass O(n) solution: Pass 1: if s[l] != s[r], ch 阅读全文
posted @ 2017-12-23 10:32 Tonix 阅读(120) 评论(0) 推荐(0) 编辑

2017年12月22日

摘要: Over-thinking will not get you there though : ) The trick is QUITE easy: # of unique chars. 阅读全文
posted @ 2017-12-22 05:30 Tonix 阅读(123) 评论(0) 推荐(0) 编辑

2017年11月27日

摘要: Nice problem that can help you understand 2 key skills below: - How to choose between Greedy and DP Is the local optimal the ONLY option? Can other ch 阅读全文
posted @ 2017-11-27 09:54 Tonix 阅读(244) 评论(0) 推荐(0) 编辑

2017年5月12日

摘要: Swapping - is actually a useless mask to the sln of this problem. The invariance of this problem is, swapping doesn't change # of balls in each contai 阅读全文
posted @ 2017-05-12 12:48 Tonix 阅读(326) 评论(0) 推荐(0) 编辑

摘要: Hey I found problems on HackerRank is more interesting than ones on LeetCode.. Strategy: observe\analyze bit by bit - DISCRETE THINKING. The idea is l 阅读全文
posted @ 2017-05-12 12:43 Tonix 阅读(158) 评论(0) 推荐(0) 编辑

2017年3月1日

摘要: A different approach to the problem, besides the popular math solution. 阅读全文
posted @ 2017-03-01 04:57 Tonix 阅读(114) 评论(0) 推荐(0) 编辑

2017年2月27日

摘要: A variation of 'maximum sum of subarray' - using hashmap 阅读全文
posted @ 2017-02-27 11:30 Tonix 阅读(112) 评论(0) 推荐(0) 编辑

2017年2月13日

摘要: Play it in your mind.. or it may be hard to reach to this intuitive solution... 阅读全文
posted @ 2017-02-13 11:35 Tonix 阅读(135) 评论(0) 推荐(0) 编辑

2017年2月12日

摘要: My first try was very close to a final solution .. however, this is a much neater solution: https://discuss.leetcode.com/topic/69436/concise-c-o-1-sol 阅读全文
posted @ 2017-02-12 15:22 Tonix 阅读(98) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 25 下一页