X474: Queues - Ice Cream Line

You’re an employee at an ice cream shop and your shop needs help organizing who’s in line. People usually come to this shop with their loved ones because there’s sometimes a discount. Because of this, you usually see people come in two at a time. Your job is to add each customer to Queue so you can keep track on who to serve next. But it seems like every day there’s problem with the person in the front of the line. That person always orders the most complicated desserts. To solve this, you’ll have to also move the person in the front of the line all the way to the back. Return the Queue with the people in the correct order.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.