"Coding is just like talking to a unknown girl. Once you talked to her with guts, the next time you'll never afraid",Really? Yes , try it Now !!!
Everything here is for education and learning purpose only , individual holds rights on outer posts/links etc.
Team Cracking The Code
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.
Example if nCards=9 and ICut=6 then for N=123456789 , you need 3 shuffle to get the original positions , wondering how , try it now and feel free to post comment here .
1 comment :
what is its actually doing will you explain ?
min(minInsert(a[1:]),minInsert(a[:-1])) ??
Post a Comment