|
|
|
|
|
by sdenton4
354 days ago
|
|
Nice! My offhand solution not using xor is to subtract from the sum of 1 to n, which has a closed form solution. The closed form roughly halves the execution time, as we only have to iterate over the range once. Good to know there's a similar speedup available on the xor path... |
|