This post originally appeared on Arjun Rajkumar 's blog. Arjun is a web developer based in Bangalore, India.
Write a method to tell us if a full deck of cards shuffled_deck is a single riffle of two other halves half1 and half2.
We'll represent a stack of cards as an array of integers in the range 1..52 (since there are 52 distinct cards in a deck).
If you want to follow along, feel free to post your answers in the comment.
My answers are in the comments.