Suppose we have a vector:
v <- c(0,0,0,1,0,0,0,1,1,1,0,0)
Expected output:
v_index <- c(5,6,7)
v
always starts and ends with 0
. There is only one possibility of having cluster of zeros between two 1
s.
Seems simple enough, can't get my head around...