摘要: I think the following code is self-explanatory enough. We use anunordered_map countsto record the expected times of each word and anotherunordered_map... 阅读全文
posted @ 2015-07-06 22:32 jianchao-li 阅读(215) 评论(0) 推荐(0) 编辑
摘要: By far the best solution I have seen is of O(n) time (some solutions claim to be of O(logn)turns out to be O(n)). One of the simplest ideas is to comp... 阅读全文
posted @ 2015-07-06 18:16 jianchao-li 阅读(227) 评论(0) 推荐(0) 编辑
摘要: Well, since theheadpointer may also be modified, we create anew_headthat points to it to facilitate the reverse process.For the example list1 -> 2 -> ... 阅读全文
posted @ 2015-07-06 15:08 jianchao-li 阅读(166) 评论(0) 推荐(0) 编辑
摘要: Well, since theheadpointer may also be modified, we create anew_headthat points to it to facilitate the reverse process.For the example list1 -> 2 -> ... 阅读全文
posted @ 2015-07-06 14:54 jianchao-li 阅读(252) 评论(0) 推荐(0) 编辑
摘要: Well, since theheadpointer may also been modified, we create anew_headthat points to it to facilitate the swapping process.For the example list1 -> 2 ... 阅读全文
posted @ 2015-07-06 14:22 jianchao-li 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 动态规划: 1 class Solution { 2 public: 3 /** 4 * @param s: A string 5 * @param p: A string includes "?" and "*" 6 * @return: A boolean... 阅读全文
posted @ 2015-07-06 12:06 jianchao-li 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Well, so many people has tried to solve this problem using DP. And almost all of them get TLE (if you see aC++DP solution that gets accepted, please l... 阅读全文
posted @ 2015-07-06 11:57 jianchao-li 阅读(241) 评论(0) 推荐(0) 编辑
摘要: Well, the idea of this problem is actually very sample --- keep merging the unmerged lists in lists until there is exactly one list remained. However,... 阅读全文
posted @ 2015-07-06 00:49 jianchao-li 阅读(165) 评论(0) 推荐(0) 编辑