</>OfferRetriever
DashboardDiscuss
NEW

Spring Hire Sale

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

$10.42$7.08

08

:

04

:

44

:

48

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. ...