tvl-depot/scratch/deepmind
William Carroll 062af32e4e Solve InterviewCake's find duplicate beast mode
Write a function to find a duplicate item in a list of numbers. The values are
in the range [1, n]; the length of the list is n + 1. The solution should run in
linear time and consume constant space.

The solution is to construct a graph from the list. Each graph will have a cycle
where the last element in the cycle is a duplicate value.

See the solution for specific techniques on how to compute the length the cycle
without infinitely looping.
2020-03-26 11:55:06 +00:00
..
part_one Tidy up structure of briefcase 2020-02-12 16:58:29 +00:00
part_two Solve InterviewCake's find duplicate beast mode 2020-03-26 11:55:06 +00:00