Company: Sprinklr
Difficulty: easy
A service centre has a queue of N customers waiting to be served. The server follows a unique alternating pattern: Step 1. Serve the customer who is currently first in line. That customer leaves the queue. Step 2. Then take the customer who is now first in line and move them to the back of the queue without serving them. The two steps repeat — serve one, relocate one, serve one, relocate one — until every customer has been served. Each customer is identified by a unique ID number. Your task is to determine the order in which the customers are eventually served. Input Format The first line contains an integer N , the number of customers. The second line contains N space-separated integers, the IDs of the customers in their initial queue order, from the front of the queue to the back. Output Format Print N space-separated integers on a single line: the customer IDs in the order in which they are served. Constraints 1 <= N <= 2000 1 <= queue[i] <= 1000000 All customer IDs are