I saw this in a careers section of a very nice website. Did you say "Why haven’t I just give the link?" Two reasons. They might just change it to a new one or totally remove it as they don’t have that position anymore. Second, I don’t want you to know where I’m looking for an opening 😉
Here we go… Serious one in a while…
Programming Problem
Given a deck of nCards unique cards, cut the deck iCut cards from top and perform a perfect shuffle. A perfect shuffle begins by putting down the bottom card from the top portion of the deck followed by the bottom card from the bottom portion of the deck followed by the next card from the top portion, etc., alternating cards until one portion is used up. The remaining cards go on top. The problem is to find the number of perfect shuffles required to return the deck to its original order. Your function should be declared as:
static long shuffles(int nCards,int iCut);
Please enter the result of shuffles(1002,101) along with your program down in the comments.
Looking forward to the answers so that I can apply for the job… Hurry up…