JS solution


  • 0
    C
    /**
     * @param {number[]} nums
     * @return {number}
     */
    var arrayPairSum = function(nums) {
        var number = 0;
        nums.sort(function(a,b){return a-b});
        for (var i = 0; i < nums.length; i=i+2) {
        	number += nums[i];
        }
        return number;
    };
    

Log in to reply
 

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