Javascript 1 line


  • 0
    R
    var arrayPairSum = function(nums) {
       return nums.sort((a, b)=>parseInt(a)-parseInt(b)).reduce((t, n, i)=>(i+1)%2 ? t+parseInt(n): t)
    };
    

Log in to reply
 

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