i am trying to solve additive number
case: "4012212782529046568"
4012+21278=25290 46568
21278+25290=46568
this is the core idea of the question.
a+b==c you have to verify then
a=b
b=c
then get new c and repeat a+b==c kind of sort of thing on the given string
string length is like 1<=len<=35
so my typical backtracking approach is giving correct answer for smaller working cases but not for larger ones.
so my doubt is will it give correct output for larger input even if it takes a lot of time?
how can i optimize it?
what logic am i missing here.
Below is the code for your Reference