Consecutive Yoga Slots at FlexYoga
Consecutive Yoga Slots at FlexYoga
EasyArrays0% accepted
Arjun searches FlexYoga Mumbai for N consecutive available slots to book his yoga class. The studio shows availability as 1 (open) or 0 (booked). Help him check if K consecutive slots exist.
Approach
Given array of yoga slot availability (0/1) and integer K, find if K consecutive 1s exist.
Input
slots=[1,1,0,1,1,1], K=3
Output
true
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