954-Array-Of-Doubled-Pairs
Sat 17 May 2025
https://leetcode.com/problems/array-of-doubled-pairs
import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
def canReorderDoubled(self, A: List[int]) -> bool:
count = Counter(A)
for key in sorted(count, key=abs):
if count[key] > count[2 * key]:
return False
count[2 * key] -= count[key]
return True
new Solution().canReorderDoubled()
Score: 5
Category: leetcode