Skip to main content
added 44 characters in body
Source Link
G B
  • 22.8k
  • 1
  • 20
  • 53

Ruby, 4343 40 bytes

->s,a,*r{r=[];aa.count{|x|r|*x|r!=r=(r|[x]r|x).pop(s)}}

Try it online!Try it online!

Thanks histocrat for shaving 3 bytes.

Ruby, 43 bytes

->s,a{r=[];a.count{|x|r!=r=(r|[x]).pop(s)}}

Try it online!

Ruby, 43 40 bytes

->s,a,*r{a.count{|*x|r!=r=(r|x).pop(s)}}

Try it online!

Thanks histocrat for shaving 3 bytes.

Source Link
G B
  • 22.8k
  • 1
  • 20
  • 53

Ruby, 43 bytes

->s,a{r=[];a.count{|x|r!=r=(r|[x]).pop(s)}}

Try it online!