TLE In one test case out of two
hello @ambuj_0909,
value of n can be upto 1000 000 000 and we can not declare array of that big size due to memory constraint.
so use top down dp and map .
use 0 to distinguish between visited and non visited state. ( map contains by default 0 value so no need to intialise ).
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.