Count divisors
Given a positive integer n (1 <= n <= 10^12), return the number of positive divisors of n, including 1 and n itself. For example, 12 has divisors 1, 2, 3, 4, 6, 12, so the answer is 6. The value of n can be large enough that listing every candidate up to n is too slow.
Implement
count_divisors(n: int) → intExamples
in
[12]out6What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 18 min
solution.py
InputExpectedGot
[12]6not run yetsample