Given a pattern [1,1,0,1,1]
, and a binary list of length 100, [0,1,1,0,0,...,0,1]
. I want to count the number of occurences of this pattern in this list. Is there a simple way to do this without the need to track the each item at every index with a variable?
Note something like this, [...,1, 1, 0, 1, 1, 1, 1, 0, 1, 1,...,0]
can occur but this should be counted as 2 occurrences.