Diwali puzzle DP

code–tps://ide.codingblocks.com/s/293521

//when current element we put is zero
ans = ans + f(i+1, 0,cnt);

This part of code when will be execute ?

We will try to put 0 irrespective of what the previous element has 0 or 1.