摘要: // 参考了下面一些讨论的解法 // https://discuss.leetcode.com/topic/53235/java-with-hashtable-arraylist/2 class RandomizedSet { vector vec; unordered_map umap; public: /** Initialize your data structu... 阅读全文
posted @ 2016-08-04 22:59 blcblc 阅读(275) 评论(0) 推荐(0)
摘要: //有很多讨论,比如 // https://discuss.leetcode.com/topic/52865/my-solution-using-binary-search-in-c // https://discuss.leetcode.com/topic/52912/binary-search-heap-and-sorting-comparison-with-concise-code-and... 阅读全文
posted @ 2016-08-02 14:41 blcblc 阅读(258) 评论(0) 推荐(0)
摘要: #include class Solution { unordered_map dp_map; vector vec; int func(int target) { if (dp_map.find(target) != dp_map.end()) { return dp_map[target]; ... 阅读全文
posted @ 2016-08-01 15:22 blcblc 阅读(224) 评论(0) 推荐(0)
摘要: // 参考了:https://discuss.leetcode.com/topic/51893/two-solutions-one-is-dp-the-other-is-greedy-8-lines // 另有:https://discuss.leetcode.com/topic/51946/very-simple-java-solution-with-detail-explanation c... 阅读全文
posted @ 2016-08-01 14:06 blcblc 阅读(432) 评论(0) 推荐(0)
摘要: 【本文系外部转贴,原文地址:http://coolshell.info/c/c++/2014/12/13/c-open-project.htm】 下次造轮子前先看看现有的轮子吧 值得学习的C语言开源项目 - 1. Webbench Webbench是一个在linux下使用的非常简单的网站压测工具。它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能,最多可以模... 阅读全文
posted @ 2016-07-25 15:05 blcblc 阅读(23139) 评论(0) 推荐(0)
摘要: // https://discuss.leetcode.com/topic/51353/simple-dp-solution-with-explanation // https://en.wikipedia.org/wiki/Minimax // 开始我的思路有问题,我是先选择区间,最后收敛到结果数 // 实际上work的思路是,先选择数字,再走向某个区间,然后取两个区间中的更大值 class... 阅读全文
posted @ 2016-07-18 14:50 blcblc 阅读(184) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/guess-number-higher-or-lower/ 阅读全文
posted @ 2016-07-14 13:29 blcblc 阅读(284) 评论(0) 推荐(0)
摘要: // https://discuss.leetcode.com/topic/50527/java-10ms-solution-no-priority-queue class Solution { public: vector> kSmallestPairs(vector& nums1, vector& nums2, int k) { sort(nums1.begin()... 阅读全文
posted @ 2016-07-10 15:00 blcblc 阅读(232) 评论(0) 推荐(0)
摘要: // https://discuss.leetcode.com/topic/50489/c-clean-and-short-solution class Solution { int base = 1337; int powMod(int a, int b) { a %= base; int result = 1; for (in... 阅读全文
posted @ 2016-07-10 14:10 blcblc 阅读(223) 评论(0) 推荐(0)
摘要: // refer to // https://leetcode.com/discuss/111582/java-simple-easy-understand-solution-with-explanation class Solution { public: int getSum(int a, int b) { //int tmp_sum = a ^ b; // a x... 阅读全文
posted @ 2016-06-30 17:31 blcblc 阅读(241) 评论(0) 推荐(0)