14 lines
347 B
Python
14 lines
347 B
Python
# https://leetcode.com/problems/divide-array-into-equal-pairs
|
|
|
|
from typing import List, Set
|
|
|
|
class Solution:
|
|
def divideArray(self, nums: List[int]) -> bool:
|
|
s: Set[int] = set()
|
|
for num in nums:
|
|
if num in s:
|
|
s.remove(num)
|
|
else:
|
|
s.add(num)
|
|
return not bool(len(s))
|
|
|