diff --git a/extra/queue-to-do/solution.py b/extra/queue-to-do/solution.py new file mode 100644 index 0000000..f11590e --- /dev/null +++ b/extra/queue-to-do/solution.py @@ -0,0 +1,16 @@ +def solution(start, length): + checksum = 0 + for i in range(length): + base = start + length * i + for j in range(length - i): + checksum ^= base + j + return checksum + +tests = [ + ([0, 3], 2), + ([17, 4], 14) + ] + +for i, o in tests: + result = solution(*i) + print (i, result == o, result, o)