如何用 O(1) 的时间得知 O(n) 的信息?如果你 get 到了这一精妙之处,欢迎一键三连~
Python/Java/C++/Go/JS/Rust 代码:
167. 两数之和 II - 输入有序数组 https://leetcode.cn/problems/two-sum-ii-input-array-is-sorted/solution/san-shu-zhi-he-bu-hui-xie-xiang-xiang-sh-6wbq/
15. 三数之和 https://leetcode.cn/problems/3sum/solution/shuang-zhi-zhen-xiang-bu-ming-bai-yi-ge-pno55/
课后作业:
2824. 统计和小于目标的下标对数目 https://leetcode.cn/problems/count-pairs-whose-sum-is-less-than-target/
16. 最接近的三数之和 https://leetcode.cn/problems/3sum-closest/
18. 四数之和 https://leetcode.cn/problems/4sum/
611. 有效三角形的个数 https://leetcode.cn/problems/valid-triangle-number/
课后作业题解:
2824. 统计和小于目标的下标对数目 https://leetcode.cn/problems/count-pairs-whose-sum-is-less-than-target/solution/onlogn-pai-xu-shuang-zhi-zhen-by-endless-qk40/
16. 最接近的三数之和 https://leetcode.cn/problems/3sum-closest/solution/ji-zhi-you-hua-ji-yu-san-shu-zhi-he-de-z-qgqi/
18. 四数之和 https://leetcode.cn/problems/4sum/solution/ji-zhi-you-hua-ji-yu-san-shu-zhi-he-de-z-1f0b/
611. 有效三角形的个数 https://leetcode.cn/problems/valid-triangle-number/solution/zhuan-huan-cheng-abcyong-xiang-xiang-shu-1ex3/
【基础算法精讲】题目+题解汇总:
https://github.com/EndlessCheng/codeforces-go/blob/master/leetcode/README.md