← Nagarro questions

Play all songs randomly in n iterations with O(n) time complexity

Filed under Nagarro

Given an array of n songs, simulate playing a random song at each step across n iterations such that every song is played exactly once. The entire process must run in O(n) time and O(1) auxiliary…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Nagarro questions

Collected from public candidate posts and coding forums. Updated Nov 2026.