Tony's Log

Algorithms, Distributed System, Machine Learning

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

2015年11月26日

摘要: Simple data structure but not that easy to figure out.. MHT -> balanced tree.https://leetcode.com/problems/minimum-height-trees/Lesson learnt: Focus o... 阅读全文
posted @ 2015-11-26 16:02 Tonix 阅读(190) 评论(0) 推荐(0)

摘要: A sly knapsack problem in disguise! Thanks tohttps://github.com/bhajunsingh/programming-challanges/tree/master/hackerrank/algorithms/the-indian-jobLes... 阅读全文
posted @ 2015-11-26 08:44 Tonix 阅读(303) 评论(0) 推荐(0)

摘要: I had the same BFS idea as one of the AC code this: because dying pattern is spead from the initial dying ones :)#include #include #include using name... 阅读全文
posted @ 2015-11-26 07:10 Tonix 阅读(1005) 评论(0) 推荐(0)

摘要: Learnt from here:http://www.cnblogs.com/lautsie/p/3798165.htmlIdea is: we union all pure black edges so we get 1+ pure black edge groups. Then we can ... 阅读全文
posted @ 2015-11-26 03:51 Tonix 阅读(244) 评论(0) 推荐(0)

摘要: Very good DP one.First I figured out a O(n^2) solution:class Solution {public: int maxProfit(vector& prices) { int n = prices.si... 阅读全文
posted @ 2015-11-26 02:47 Tonix 阅读(247) 评论(0) 推荐(0)