954. Array of Doubled Pairs - notruilin/LeetCode GitHub Wiki

Greedy, if x is the smallest value (abs) currently, there must be 2x

1. Counter

count = {}
for x in A:
  if x in count:
    count[x] += 1
  else:
    count[x] = 1 

can be replaced by:

count = collections.Counter(A)

2. Sorting by absolute value

sorted(A, key = abs)