上一页 1 ··· 224 225 226 227 228 229 230 231 232 ··· 295 下一页
摘要: 题目和解答在这里: http://www.cnblogs.com/grandyang/p/5291058.html 真的非常巧妙。和之前那个建房子的题目有点像: http://www.cnblogs.com/charlesblc/p/6444151.html 但是题意比之前建房子这个直接,解法,我本 阅读全文
posted @ 2017-02-26 13:55 blcblc 阅读(277) 评论(0) 推荐(0)
摘要: 题目: https://leetcode.com/problems/populating-next-right-pointers-in-each-node-ii/?tab=Description 用一个next指针,实现树的每一层的横向连接。 下面这个解法,非常清爽: https://discuss 阅读全文
posted @ 2017-02-26 13:31 blcblc 阅读(334) 评论(0) 推荐(0)
摘要: 昨天一道题目用了lower_bound,大致了解了lower_bound指的是第一个>=x的位置。但是之前对于upper_bound有误解,其实upper_bound指的是第一个>x的位置。 STL里面应该都是用二分法来实现的。 具体的实现方式,看这里: http://www.cnblogs.com 阅读全文
posted @ 2017-02-26 13:29 blcblc 阅读(318) 评论(0) 推荐(0)
摘要: 原题目: http://www.cnblogs.com/grandyang/p/5297683.html 但是上面的解法写的不好。看下面的: https://discuss.leetcode.com/topic/31702/36-ms-c-solution 就是从每一个房子出发,用BFS,算出每个空 阅读全文
posted @ 2017-02-26 13:12 blcblc 阅读(235) 评论(0) 推荐(0)
摘要: 以前看过:http://www.cnblogs.com/charlesblc/p/5619932.html 复习一下。 阅读全文
posted @ 2017-02-26 12:51 blcblc 阅读(252) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/split-array-largest-sum/?tab=Description 开始用的是回溯法,很常规,但是TLE了。根据下面的解法,用的是结果集的反向判断。 https://discuss.leetcode.com/topic/613 阅读全文
posted @ 2017-02-26 12:36 blcblc 阅读(223) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/search-in-rotated-sorted-array/?tab=Description 很好的很经典的题目。今天复习了一下。之前的思路虽然有了,但是对于相等的数字的处理很复杂,容易出错。今天看到了一个很好的解法。 https://d 阅读全文
posted @ 2017-02-26 12:07 blcblc 阅读(684) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/russian-doll-envelopes/?tab=Description 包信封问题,可以转化成最长有序子序列问题,见下面的分析: https://discuss.leetcode.com/topic/47469/java-nlogn 阅读全文
posted @ 2017-02-26 01:17 blcblc 阅读(259) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/serialize-and-deserialize-binary-tree/?tab=Description 下面这个解法里面的C++部分很好: https://discuss.leetcode.com/topic/28041/recurs 阅读全文
posted @ 2017-02-26 00:42 blcblc 阅读(394) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/patching-array/?tab=Description 好题目啊,下面的解法绝顶聪明: https://discuss.leetcode.com/topic/35494/solution-explanation 阅读全文
posted @ 2017-02-26 00:38 blcblc 阅读(159) 评论(0) 推荐(0)
上一页 1 ··· 224 225 226 227 228 229 230 231 232 ··· 295 下一页