Leetcode 561 Solution
This article provides solution to leetcode question 561 (array-partition-i).
Access this page by simply typing in "lcs 561" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/array-partition-i
Solution
class Solution:
def arrayPairSum(self, nums: List[int]) -> int:
nums.sort()
return sum([num for i, num in enumerate(nums) if i % 2 == 0])