Python 2-line solution


  • 0
     def arrayPairSum(self, nums):
            nums.sort()
            return sum([nums[i] for i in range(0,len(nums)) if i%2==0])
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.