Top down approach for atcoder dp task A

It’s passing some of the cases when I submit otherwise it is showing TLE

@akh.chakraborty11
int solve(vi &a,ll i,ll n)
you have to pass the vector a by reference, because you are passing by value, a new copy is created in each function call which takes O(n) time.

1 Like