CODERLIF - Editorial

The problem just asks whether a given array does it contain more than 5 consecutive ones? This can be done iterating over the array and by maintaining the count of consecutive ones.

ok = True
cnt = 0
for i in range(n):
	if a[i]:
		cnt += 1
	else
		cnt = 0
	if (cnt > 5):
		ok = False