</>OfferRetriever
DashboardDiscuss
NEW

July 4th Sale

Limited Time Deal: Unlock all premium questions for over 40% off

$10.42$6.25

10

:

09

:

27

:

17

Get this deal
Back to Dashboard

Shuffle Playlist Verifier

Medium

A podcast platform uses two playback modes: Loop Mode (random picks, repeats allowed) and Rotation Mode (cycles through all episodes in a random order, then reshuffles and repeats). You are given allEpisodes, a list of unique episode IDs, and history, a sequence of episodes that were played. Determine if history could have been generated by Rotation Mode.

In Rotation Mode the player creates a random permutation of all episodes, plays through it completely, then creates a new random permutation and repeats indefinitely. The user may have started listening part-way through a permutation and stopped at any point. ...