Originally Posted by

**eyesackery**
Thank you very much for your help, this algorithm solved the problem. Simple after I had visualized it with the deck of cards, what great advice!

No problem. A big part of programming is actually taking a step back and thinking about the problem without a computer. It's hard to figure out how to write a program that solves the problem if you don't know how you would solve the problem in the first place. And a lot of problems have solutions that are like "I don't know, I just do it in my head!", so thinking about a concrete instance of the problem helps think about what your brain is actually doing to solve the problem.