He was asking for the _algorithm_ not the solution.
The constant time approximation is (count^2) / 2
365 * 365 / 2 = 66,612.5
I'm sure there is a constant time exact solution as well :-)
The constant time approximation is (count^2) / 2
365 * 365 / 2 = 66,612.5
I'm sure there is a constant time exact solution as well :-)
x = 365; ((x + 1) * x) / 2 # 66795
For x > 2 and odd.