Tony's Log

Algorithms, Distributed System, Machine Learning

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

2014年7月23日

摘要: Nothing to hard to think. Just take care of boundary conditions.class Solution {public: string convert(string s, int nRows) { if(s.empty() |... 阅读全文
posted @ 2014-07-23 12:54 Tonix 阅读(168) 评论(0) 推荐(0)

摘要: Two passes: all pointer linking info will be recorded in 1st pass - to hashmap; 2nd pass recover the pointer relationship from hashmap.1A!class Soluti... 阅读全文
posted @ 2014-07-23 12:39 Tonix 阅读(151) 评论(0) 推荐(0)

摘要: Another Double pointer solution. 1A!class Solution {public: ListNode *removeNthFromEnd(ListNode *head, int n) { ListNode *p = NULL; ... 阅读全文
posted @ 2014-07-23 11:41 Tonix 阅读(123) 评论(0) 推荐(0)

摘要: 2 solutions: bin-search and Newton iteration.class Solution {public: int _sqrt(long long tgt, long long i0, long long i1) { long long can... 阅读全文
posted @ 2014-07-23 05:41 Tonix 阅读(170) 评论(0) 推荐(0)

摘要: Another textbook problem. We take back of postorder array as the current root, and then we can split the inorder array: 1st half for current right chi... 阅读全文
posted @ 2014-07-23 04:13 Tonix 阅读(145) 评论(0) 推荐(0)

摘要: A collegiate textbook problem. Nothing special, but just take care of your memory use.class Solution {public: TreeNode *_buildTree(int pre[], int &... 阅读全文
posted @ 2014-07-23 03:29 Tonix 阅读(127) 评论(0) 推荐(0)