Is it not an approach to solve this problem

i have not included the memoization part…but i wanted to knw if my approach is correct or not

No! your code logic is incorrect!
just think what will happen for sum=0 (it goes in infinite loop)
Also mere even sum cannot guarantee that it can be divided into two halves!
for example: n=2, {1,3}
sum=4 (even) but answer is 0.

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.