Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

0561 - Array Partition I #369

@stevehan00

Description

@stevehan00

Description of the Problem

First, given array is sorted. And the sum was obtained by increasing the index of the array by two. That is sum of min(ai, bi) at problem.

Code

class Solution:
    def arrayPairSum(self, nums: List[int]) -> int:
        return sum(sorted(nums)[::2])

Link To The LeetCode Problem

LeetCode

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions