Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Revisions

3 of 3
specified output
Riolku
  • 451
  • 2
  • 4

Python 3, (削除) 96 (削除ここまで) (削除) 87 (削除ここまで) 85 bytes

def f(a):
	c=p=0
	for x in a:
		if p*x:return
		p|=x;c+=1
		if c>=p>0:c=p=0
	return p

Try it online!

-5 bytes thanks to 79037662.

-6 bytes thanks to HyperNeutrino.

None and positive are falsy, 0 is truthy.

Riolku
  • 451
  • 2
  • 4

AltStyle によって変換されたページ (->オリジナル) /