Answered step by step
Verified Expert Solution
Question
1 Approved Answer
N people wants to sit there is a line with length K containe some available seats,they want to know if they can find consecutive seats
N people wants to sit there is a line with length K containe some available seats,they want to know if they can find consecutive seats available to sit .
Input Format
first line contain K and N
the length of the line : K
number of people : N
second line contain string
string represent the seats 0 mean this seat is available , 1 mean this seat is already taken .
Constraints
1<=N,k<=10^5
Output Format
print YES if they can find a place to set otherwise print NO
Sample Input 0
5 2 10101
Sample Output 0
NO
Sample Input 1
6 3 000011
Sample Output 1
YES
Sample Input 2
5 4 00100
Sample Output 2
NO
please in c++ or python
doesn't matter
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started