Hello…
Good Morning…
I am solving this question from Hackerearth…
I have solved this question using DP+MEMOIZATION…
even now it is showing Tle…
So i thought that do the precomputation for each value of n from 2 to 10**4… Now after that it was showing TLE in all test cases…
These are the two submission…
1)https://www.hackerearth.com/submission/51561426/
2)https://www.hackerearth.com/submission/51561457/
Please see this.
Thanks