Indian Railway Seat Availability Check
Indian Railway Seat Availability Check
MediumArrays0% accepted
An IRCTC ticket booking system in Mumbai manages seat availability across coaches. For a multi-coach train, each element in an array represents available seats in that coach. Find if there exists a sequence of N consecutive coaches with at least K seats each.
Approach
Given an array of available seats per coach and requirements (N coaches, K seats minimum), find if any N consecutive coaches have >= K seats each.
Input
n=8
N=3
K=20
arr=[15,25,30,18,22,20,16,28]
Output
1
More Arrays 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