If you take an array of size 6 and array to be [1, 1, 1, 1, 1, 1], the answer should be 1 for (1, 1) (1, 1) (1, 1). However the expected output for the same is coming to be 0

Use the following input, you should be able to see the right answer 6 6 1 1 1 1 1 1