Railway Waitlist Position
Railway Waitlist Position
MediumQueues100% accepted
Meera is building the IRCTC waitlist management system. When confirmed seats open up, waitlisted passengers get confirmed in order. Simulate K cancellations that free up seats and update the waitlist.
Approach
Given a waitlist queue of N passengers and K cancellations, output the remaining waitlist after confirmed passengers move up.
Input
4 2
Ajay Priya Ravi Meera
Output
["Ravi","Meera"]
More Queues problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards