Tony's Log

Algorithms, Distributed System, Machine Learning

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 25 下一页

2014年12月23日

摘要: Really interesting O(n) problem. Just like playing.. so actually working on algorithm problems is like playing games!class Solution {public: int ma... 阅读全文
posted @ 2014-12-23 05:37 Tonix 阅读(150) 评论(0) 推荐(0)

2014年12月20日

摘要: One TopCoder article introduces a very interesting alternative solution to Longest Common Sequences problem.It is based on this statement (http://comm... 阅读全文
posted @ 2014-12-20 09:40 Tonix 阅读(292) 评论(0) 推荐(0)

2014年12月16日

摘要: Binary Tree *-order traversal by recursion is trivial. But their iteration version deserves a look:Pre-Orderclass Solution { vector ret;public: ... 阅读全文
posted @ 2014-12-16 06:49 Tonix 阅读(138) 评论(0) 推荐(0)

2014年12月4日

摘要: 没什么难的,提示已经说得很明白了。HihoCoder目前还不支持C++11,囧..#include #include #include #include #include #include using namespace std;//struct Node{ Node(char rc) : c... 阅读全文
posted @ 2014-12-04 04:25 Tonix 阅读(269) 评论(0) 推荐(0)

2014年11月30日

摘要: Just reimplemented the solution to this classic problem using Manacher algorithm in my mind. So neat idea :)class Solution {public: string longestP... 阅读全文
posted @ 2014-11-30 08:07 Tonix 阅读(156) 评论(0) 推荐(0)

2014年11月27日

摘要: 目前除了暴力穷举,还没有想出更好的办法。在我的代码里枚举分为两类:在字符间添加同一\两侧之一相同的字符,如向“BC”中添加B或C;在字符间添加与一\两侧均不相同的字符,如向“BC”中添加A。之后,将新字符串按连续字符整理为块,再进行操作模拟。#include #include #include #i... 阅读全文
posted @ 2014-11-27 18:02 Tonix 阅读(999) 评论(0) 推荐(0)

2014年11月15日

摘要: Similar with version I, but analysis is different. With the possibility of duplication, only ">" indicate a definite case of next search space.class S... 阅读全文
posted @ 2014-11-15 15:54 Tonix 阅读(127) 评论(0) 推荐(0)

摘要: There's usually a common strategy for "find *" problems - binary search: half the space can be dropped by some rules.And take care of corner cases.cla... 阅读全文
posted @ 2014-11-15 15:20 Tonix 阅读(154) 评论(0) 推荐(0)

2014年11月13日

摘要: http://www.zhihu.com/question/26547156Tango Tree Taking advantage of cache locality. 'Preferred path' is a recently access searching path (which is w... 阅读全文
posted @ 2014-11-13 15:50 Tonix 阅读(180) 评论(0) 推荐(0)

2014年11月10日

摘要: Not very hard to figure out an initial solution, with min heap\monoq\stack. But the key idea is to avoid unnecessary book-keeping when new value is la... 阅读全文
posted @ 2014-11-10 12:24 Tonix 阅读(162) 评论(0) 推荐(0)

2014年11月1日

摘要: 1. LC\EPI summary Quick Sort: in C and in Haskell2. G's slides NP-Complete: salesman\knapsack(encrypted) http://blog.csdn.net/liyangbing315/artic... 阅读全文
posted @ 2014-11-01 01:11 Tonix 阅读(197) 评论(0) 推荐(0)

摘要: [Rush]a. k-sum generalized-------------------------!1. Greedy vs. DP:http://blog.csdn.net/yelbosh/article/details/7649717. Multiple choices or not:Gr... 阅读全文
posted @ 2014-11-01 01:09 Tonix 阅读(200) 评论(0) 推荐(0)

2014年10月11日

摘要: Intuitively there must a O(n) solution.First I tried a bottom-up DP solution but it had a TLE:class Solution {public: int maxProduct(int A[], int n... 阅读全文
posted @ 2014-10-11 07:41 Tonix 阅读(144) 评论(0) 推荐(0)

2014年9月13日

摘要: 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)

2014年8月28日

摘要: 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)

2014年8月26日

摘要: Welcome, T******7! You have solved151 / 151problems.It is only the first step... 阅读全文
posted @ 2014-08-26 14:15 Tonix 阅读(134) 评论(0) 推荐(0)

2014年8月24日

摘要: Man it took me numerous submissions to get AC, and I referred to this link:http://yihuad.blogspot.com/2013/11/word-ladder-ii-leetcode.htmlIdea is pret... 阅读全文
posted @ 2014-08-24 10:48 Tonix 阅读(187) 评论(0) 推荐(0)

摘要: My intuition is flood-fill the BFS solution, which is O(n^4); and then I figured out a DP solution which is O(n^4).. So I googled some hints: it can b 阅读全文
posted @ 2014-08-24 08:03 Tonix 阅读(143) 评论(0) 推荐(0)

摘要: I have to admit that I'm still an algorithm rookie: in front of a problem, I got lost on what the nature of the problem is.. usually I made everything... 阅读全文
posted @ 2014-08-24 07:23 Tonix 阅读(162) 评论(0) 推荐(0)

2014年8月22日

摘要: A really classic 2D DP problem. And I'm glad that I figured out the transfer function without checking any other resources.After that, everything is s... 阅读全文
posted @ 2014-08-22 14:57 Tonix 阅读(147) 评论(0) 推荐(0)

上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 25 下一页