Tap here to switch tabs
Problem
Submissions

Problem: Number of Music Playlists

Number of Music Playlists asks you to count playlists of a specified length made from distinct songs, using every song at least once and repeating a song only after at least k other songs. Return the count modulo a large prime.

Statement

You have n different songs and want to create a playlist of length goal.

A playlist is considered valid if:

  • Every song is played at least 11 time.

  • A song can only be played again if at least k other songs have been played after its previous occurrence.

Given n, goal, and k, return the total number of possible playlists. Since the answer can be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 0≤0 \leq k << n ≤\leq goal ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Number of Music Playlists

Number of Music Playlists asks you to count playlists of a specified length made from distinct songs, using every song at least once and repeating a song only after at least k other songs. Return the count modulo a large prime.

Statement

You have n different songs and want to create a playlist of length goal.

A playlist is considered valid if:

  • Every song is played at least 11 time.

  • A song can only be played again if at least k other songs have been played after its previous occurrence.

Given n, goal, and k, return the total number of possible playlists. Since the answer can be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 0≤0 \leq k << n ≤\leq goal ≤100\leq 100