Walmart Interview Question

Random Song problem. Check Geeksforgeeks