Bloomberg | Phone | Shuffle Cards
Anonymous User
3759
Jun 15, 2020
Jun 22, 2020
A linked list of cards are given. Write a code, to Shuffle the cards, without using inbuilt shuffle / random functions.
Functionalities :
- Create a deck of card through linked list
- Split the deck of cards randomly into 2 subsets
- Merge the subsets randomly , so that previous order is not maintained
- Display the deck of cards .
Eg:
I/p Cards: [A,4,6,7,9,K,Q,J,2]
Expected Output:
Create Linked List : [A->4->6->7->9->Q->J->2]
Split List into 3 decks : A->4->6->7 9->Q J->2
Merge the decks randomly : 9->6->7 ->Q ->J->2->4->A
Similiar Problem : [ Interviewer asked to solve using linked list ] https://leetcode.com/problems/shuffle-an-array/
Comments (9)


