I am pretty sure that this will pass verification once I change the return to the correct result array. I really wanted to understand what this code did before I used it to pass verification. I dug into it as well as I could and tried to parse out how it was working. I had already written my own code for this task, and it worked, but it was not getting verified. The only reasons that I can figure, and this was with others help, is that my code was too slow and used up too much memory. So I too turned to this code that everyone else is using for this task. But it bothered me that I didn't understand it. So here is what I have been able to figure out. I put comments line by line as to what I thought was happening. Also here is a table to use if you wanted to walk through it. I would love any feedback or corrections. Or especially any more clarity.