題目python
pythonspa
class Solution: def arrayPairSum(self, nums): """ :type nums: List[int] :rtype: int """ nums.sort() return sum(nums[::2])
思路:code
這道題,首先要意識到將list排序後,兩兩組合就能夠獲得相應的結果。blog