Able to understand question but not the approach

How should we go and solve this question. Not able to understand the video explanation and also the editorial solution.

Think of a dp approach. There will be two states in dp: the current index at which you are present , number of ways of getting even and odd sum upto that index.

dp[i][0]: We are at index i and number of ways of getting even sum till i.
dp[i][1]: We are at index i and number of ways of getting odd sum till i.

Now, try to solve this question.

@1shubhamjoshi1 A pure combinatorial approach would be difficult in this question, as a straight formula might be tough to think about. Try to think in terms of what you have now, and what would be added to the answer after you get a pair.here is code snippet.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.