leetcode_561. Array Partition I ? 待解决
2017-11-10 17:40
393 查看
Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), …, (an, bn) which makes sum of min(ai, bi) for all i from 1 to n as large as possible.
Example 1:
Input: [1,4,3,2]
Output: 4
Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2) + min(3, 4).
Note:
n is a positive integer, which is in the range of [1, 10000].
All the integers in the array will be in the range of [-10000, 10000].
提示:提交代码后,需要用简洁的语言解释一下代码思路~ 谢谢
历史题目和总结见公众号「每日一道算法题」
https://leetcode.com/problems/array-partition-i/description/
思路:
Example 1:
Input: [1,4,3,2]
Output: 4
Explanation: n is 2, and the maximum sum of pairs is 4 = min(1, 2) + min(3, 4).
Note:
n is a positive integer, which is in the range of [1, 10000].
All the integers in the array will be in the range of [-10000, 10000].
提示:提交代码后,需要用简洁的语言解释一下代码思路~ 谢谢
历史题目和总结见公众号「每日一道算法题」
https://leetcode.com/problems/array-partition-i/description/
思路:
相关文章推荐
- LeetCode | 561. Array Partition I 数学归纳法题
- 【Leetcode】561. Array Partition I(数组分割一)
- leetcode 561. Array Partition I 数组元素分组的最小值的和的最大值+直接排序即可
- LeetCode 561. Array Partition I
- leetcode -- 561. Array Partition I 【贪心算法 + 正确性证明】
- [LeetCode]561. Array Partition I (数组分区 1)
- [Leetcode] 561. Array Partition I 解题报告
- Leetcode 561. Array Partition I(Easy)
- leetcode 561. Array Partition I(C语言)10
- LeetCode——561. Array Partition I(贪心,C++)
- LeetCode-561. Array Partition I-排序
- Leetcode 561:Array Partition I
- Partition Equal Subset Sum - leetcode 416号题目个人题解
- leetcode Word Search 待解决?
- oracle interval-partition 解决range分区大难题
- BFS和DFS解决LeetCode133. Clone Graph
- Leetcode121.+Leetcode53. Kadane算法解决最大子数组问题
- Linux 启动grub error 24: Attempt to access block outside partition 解决
- LeetCode 561 Array Partition I
- [leetcode]解决Assign Cookies的一点小心得