Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. def solve(arr):
  2. # assuming there are no repeated
  3. arr.sort()
  4. divisors = [0] * len(arr) * 2
  5. for num in arr:
  6. multiple = num
  7. while num < len(arr)*2:
  8. multiple += num
  9. divisors[multiple] += 1 # here you'd add the number of elements whose value is num
  10. # TODO reconstruct result.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement