Google Interview Question

Asked to reverse engineer and explain a python code (written by the interviewer on the google doc) - essentially was a cycle detection algorithm - then told to convert it to c++ code.