Find Passenger Position in Waitlist
Find Passenger Position in Waitlist
EasyStrings50% accepted
Meera is on IRCTC railway waitlist for a Delhi to Bangalore train and wants to know her position in the queue to estimate her confirmation chances based on historical data.
Approach
Given a comma-separated waitlist string and a target passenger name separated by pipe, find and return the 1-indexed position of the passenger in the waitlist.
Input
Arjun,Meera,Priya,Ravi|Priya
Output
3
More Strings 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