Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def solve(arr):
- # assuming there are no repeated
- arr.sort()
- divisors = [0] * len(arr) * 2
- for num in arr:
- multiple = num
- while num < len(arr)*2:
- multiple += num
- divisors[multiple] += 1 # here you'd add the number of elements whose value is num
- # TODO reconstruct result.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement