摘要: 思路: 首先假设选择两侧,如果想让体积变大,应该让小的一侧移动,因为想要使小的一侧遇到比原来大的高度。每次都移动小的,直到左右两侧相遇,记录移动过程中产生的最大值。复杂度为$O(n)$ 阅读全文
posted @ 2017-06-05 22:52 UniMilky 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 两种方法: 直接遍历,复杂度为 $O(n^2)$ class Solution { public: vector twoSum(vector& nums, int target) { vector a; for(int i = 0; i twoSum(vector& nums, int target 阅读全文
posted @ 2017-06-05 22:40 UniMilky 阅读(107) 评论(0) 推荐(0) 编辑