摘要: 用了两种方法: 31 / 31 test cases passed. Accepted Runtime: 261 ms 开始用的下面这种方法,超时了: 阅读全文
posted @ 2016-06-28 14:30 blcblc 阅读(698) 评论(0) 推荐(0)
摘要: 这道题目的循环里面的那个递推的式子很巧妙,能够帮助循环快速收敛。 阅读全文
posted @ 2016-06-27 15:06 blcblc 阅读(161) 评论(0) 推荐(0)
摘要: 以下这个解法也是参考了一些讨论: https://leetcode.com/discuss/110235/c-solution-using-euclidean-algorithm 还有这个解释原理的,没有看懂:https://leetcode.com/discuss/110525/a-little- 阅读全文
posted @ 2016-06-27 14:45 blcblc 阅读(329) 评论(0) 推荐(0)
摘要: 根据上一篇文章提到的参考文档: https://leetcode.com/discuss/109749/accepted-c-codes-with-explanation-and-references 我实现的解法,用了一个sum_max,不再另设res。 27 / 27 test cases pa 阅读全文
posted @ 2016-06-27 14:22 blcblc 阅读(331) 评论(0) 推荐(0)
摘要: 今天的一道题目: https://leetcode.com/problems/max-sum-of-sub-matrix-no-larger-than-k/ 有难度。这一类题目很有代表性。 搜到这个网址有针对一维数组的求和的按照时间复杂度一步步优化的过程,讲的很不错: http://www.cnbl 阅读全文
posted @ 2016-06-27 13:39 blcblc 阅读(1010) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/count-numbers-with-unique-digits/ class Solution { public: int countNumbersWithUniqueDigits(int n) { if (n < 1) { return 1; } ... 阅读全文
posted @ 2016-06-15 16:42 blcblc 阅读(258) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/design-twitter/ class Twitter { unordered_map > follower_mp; unordered_map > followee_mp; unordered_map > > twitter_self_mp; int timestamp; public: ... 阅读全文
posted @ 2016-06-15 16:09 blcblc 阅读(212) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/russian-doll-envelopes/ // Use map (Russian doll number -> vector of envelopes) to record results // For each envelope, check above map, and when fitting envelope which... 阅读全文
posted @ 2016-06-08 00:37 blcblc 阅读(598) 评论(0) 推荐(0)
摘要: TCP的握手挥手和状态转换是很多网络问题的基础。在此进行相关问题的讨论及记录。 首先,这幅图大致介绍了TCP连接和断开的过程: 注意其中的几个状态: LISTEN, SYN-SEND, SYN-RCVD, ESTABLISHED, FIN-WAIT-1, CLOSE-WAIT, FIN_WAIT-2 阅读全文
posted @ 2016-06-07 18:48 blcblc 阅读(365) 评论(0) 推荐(0)
摘要: 有一篇文章讲得相当不错: http://www.cnblogs.com/tornadomeet/p/3395593.html 另外其中提到的龙星计划里面有一些不错的课件,可以参考: http://52opencourse.com/373/2012%E9%BE%99%E6%98%9F%E8%AE%A1 阅读全文
posted @ 2016-06-05 19:45 blcblc 阅读(510) 评论(0) 推荐(0)