Design a deck of cards with shuffle/draw
Company: Apple
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
## Object-Oriented Design + Randomness
Design an in-memory model of a standard 52-card deck.
### Requirements
- Create classes to represent at least:
- `Card` (rank and suit)
- `Deck` (a collection of cards)
- The `Deck` must support:
1. `shuffle()` — randomizes the order of the remaining cards.
2. `draw()` — removes and returns one card from the deck.
### Correctness / Probability Constraints
- After calling `shuffle()`, every permutation of the remaining cards should be equally likely (i.e., an unbiased shuffle).
- Each `draw()` should return each remaining card with equal probability at that moment.
### Additional Considerations
- Define what should happen when `draw()` is called on an empty deck.
- Discuss time/space complexity targets for `shuffle()` and `draw()`.
- You may assume a good PRNG is available (e.g., `Random`).
Quick Answer: This question evaluates object-oriented design skills, understanding of randomness and probability in algorithms, and analysis of time/space complexity for data structures and operations.