JavaScript solution


  • 0
    C
    var arrayPairSum = function(nums) {
        len = nums.length
        nums = nums.sort((x,y)=>x-y)
        sum = 0
        
        do
            sum += nums[len-2]
        while (len-=2)
        
        return sum
    };
    

Log in to reply
 

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