Tony's Log

Algorithms, Distributed System, Machine Learning

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

2014年7月18日

摘要: Another recursion-style problem.1. Each count of sub-solution with a certain root should contribute to final count2. With a certain root, the num of l... 阅读全文
posted @ 2014-07-18 14:13 Tonix 阅读(116) 评论(0) 推荐(0)

摘要: A simple 1D searching problem. Binary search of course.But.. STL has already done it for you:class Solution {public: int searchInsert(int A[], int ... 阅读全文
posted @ 2014-07-18 13:51 Tonix 阅读(95) 评论(0) 推荐(0)

摘要: Since no order requirement, we can simply swap the target value to the last non-target-value in the array - if the last non-target-value is not behind... 阅读全文
posted @ 2014-07-18 13:35 Tonix 阅读(120) 评论(0) 推荐(0)

摘要: The best way to learn DP from DFS! Nice problem.My intuition is that it can be solved by DFS:class Solution {public: int climbStairs(int n) { ... 阅读全文
posted @ 2014-07-18 12:49 Tonix 阅读(164) 评论(0) 推荐(0)

摘要: Not very hard to figure out the solution: splitting the list into 2 halves; reverse the 2nd half and interleave the two halves.But it takes some time ... 阅读全文
posted @ 2014-07-18 04:10 Tonix 阅读(152) 评论(0) 推荐(0)

摘要: The key of this problem is about details especially boundary conditions.class Solution {public: ListNode *deleteDuplicates(ListNode *head) { ... 阅读全文
posted @ 2014-07-18 01:01 Tonix 阅读(129) 评论(0) 推荐(0)