728x90
LeetCode-561
Array Partition : find maximum (minimum list)
note : len(list) = 2n
myAnswer
:::python
class Solution:
def arrayPairSum(self, nums: List[int]) -> int:
nums.sort()
return sum(nums[::2])
Result : 267ms Memory: 16.7mb
๋ฐ์ํ
'๐ข One step' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[leetcode-121] Best Time to Buy and Sell Stock (0) | 2023.03.09 |
---|---|
[leetcode-238] Product of Array Except Self (0) | 2023.03.08 |
[leetcode-15] Three Sum (0) | 2023.03.06 |
[leetcode-42] Trapping Rain Water (0) | 2023.03.05 |
[leetcode-1] Two Sum (0) | 2023.03.04 |