Python 3, 96 bytes
def f(a,c=0,p=0):
for x in a:
if p and x:return
p|=x;c+=1
if p and c>=p:c=p=0
return p<1
Riolku
- 451
- 2
- 4
Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange