leetle

Daily challenge for 2025-08-05

217. Playlist Shuffle Generator

Write a function solve that shuffles a playlist while avoiding consecutive songs by the same artist. Input is a list of [song, artist] pairs. Return a valid shuffle order as indices, or empty list if impossible.

Example:
Input: [["Song1", "ArtistA"], ["Song2", "ArtistB"], ["Song3", "ArtistA"]]
Output: [0, 1, 2] (or any valid permutation)

Run this challenge interactively in Python or JavaScript when the app loads.