Ctrl K

Playlist on Repeat

Easy
The playlist tracks lists song numbers in play order. The player is set to repeat, and the playlist will play exactly twice in a row. Return every song in the order it will be heard; the answer has length 2 * len(tracks).
Example 1
tracks=[4, 9, 2] → [4, 9, 2, 4, 9, 2]

The playlist 4, 9, 2 plays twice in a row.

Example 2
tracks=[5, 5] → [5, 5, 5, 5]

Repeats inside the playlist stay put, so there are four 5s.

Example 3
tracks=[1000] → [1000, 1000]
Constraints
  • 1 ≤ len(tracks) ≤ 1000
  • 1 ≤ tracks[i] ≤ 1000
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsHow Long the Light Stayed On EasyRepack the Tray EasyQuiz Score Log EasyMirror and Negate a Bitmap EasySwap Rows and Columns Easy
loading Python…
Input
tracks=[4, 9, 2]
Expected
[4, 9, 2, 4, 9, 2]

Run checks the first 3 tests in your browser. Submit checks all 71 tests on the server, hidden ones included.