난이도 : ⭐️
class Solution:
def arrayPairSum(self, nums: List[int]) -> int:
nums.sort()
result = 0
for i in nums[::2]:
result += i
return result
runtime : 280 ms
class Solution:
def arrayPairSum(self, nums: List[int]) -> int:
return sum(sorted(nums)[::2])
runtime : 268 ms