HomeAway Interview Question: Design a card, a deck of card... | Glassdoor

Interview Question

Software Engineer Interview Austin, TX

Design a card, a deck of card in OOP and write shuffle

  method assuming you have a random function. Write the code

Interview Answer

1 Answer


Shuffle method is tricky if you don't know the answer. Randomly select a card from 0 to i with i initialized to 51, swap that card with the the card at i-th index. Decrement i and continue until i == 0

Interview Candidate on Nov 16, 2010

Add Answers or Comments

To comment on this, Sign In or Sign Up.