left
and right
to 0
, a counter count
for odd numbers, and a variable result
to store the number of nice subarrays.right
pointer.k
.k
is less than 0
, increment the left
pointer and adjust k
accordingly.right
and left
pointers plus one to the result
.result
as the final answer.