⌘K
Flycodx

IRCTC Waitlist Position Finder

IRCTC Waitlist Position Finder

EasyArrays100% accepted

Priya is on the IRCTC waitlist in Bangalore for a train ticket. Given an array of waitlist entries showing passenger IDs, she needs to find her position number.

Approach

Given an array of passenger IDs and a target ID, find the index position (0-indexed).

Input

["PRA001", "RAJ002", "MEERA03", "ARJUN04"], target="MEERA03"

Output

2
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
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3