Tony's Log

Algorithms, Distributed System, Machine Learning

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

随笔分类 -  HackerRank

上一页 1 ··· 3 4 5 6 7

摘要:Point: not necessarily contigous max sub array, at least one element should be selected:def maxSubarrCont(arr, n): ret = arr[0] curr = arr[0] ... 阅读全文
posted @ 2015-03-03 16:20 Tonix 阅读(278) 评论(0) 推荐(0)

摘要:In Haskell. Two points: 1. pruning 2. Int suffers from overflow. Integer it is.getPowerSum :: Integer -> [Integer] -> Integer -> IntegergetPowerSum _ ... 阅读全文
posted @ 2015-03-03 03:16 Tonix 阅读(232) 评论(0) 推荐(0)

摘要:Greedy beats DP this time...I tried several DP solutions first, but all failed with RE\TLE. If you 'feel' the problem, Greedy should be working:(A sol... 阅读全文
posted @ 2015-03-02 11:30 Tonix 阅读(197) 评论(0) 推荐(0)

摘要:All about pruning and duplication removal. Took me several submissions to get it AC:#include #include #include #include #include #include using namesp... 阅读全文
posted @ 2015-02-28 07:52 Tonix 阅读(181) 评论(0) 推荐(0)

摘要:An iterative 'simulation' problem:#include #include #include #include #include using namespace std;int main() { int t, n, c, m; cin >> t; whi... 阅读全文
posted @ 2015-02-27 15:10 Tonix 阅读(153) 评论(0) 推荐(0)

摘要:The punch line to this problem is the support to very very large int handling. I tried C++ code for multiple times, but it only passed first 13~ cases 阅读全文
posted @ 2015-02-27 14:58 Tonix 阅读(153) 评论(0) 推荐(0)

摘要:You may also have seen this problem in interview questions. Two cases:1. all chars have even numbers of it2. only 1 char have odd numbers of it#includ... 阅读全文
posted @ 2015-02-27 07:05 Tonix 阅读(173) 评论(0) 推荐(0)

摘要:https://www.hackerrank.com/challenges/angry-childrenAmong N ints, pick K with min 'unfairness' (max of k - min of k). Here's the strategy: larger numb... 阅读全文
posted @ 2015-02-27 06:47 Tonix 阅读(538) 评论(0) 推荐(0)

摘要:We compare two end' (current) chars and the key is how to check when there's a mismatch - DFS.#include #include #include #include #include #include us... 阅读全文
posted @ 2014-09-13 11:59 Tonix 阅读(176) 评论(0) 推荐(0)

摘要:A natural thought is brutal-force. But as you may have already thought of, there must be a smarter one. And yes there is.Think like this: XOR gives yo... 阅读全文
posted @ 2014-08-28 12:02 Tonix 阅读(267) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7