The repository that contains all solutions made for the course Competitive Programming and Contests by the University of Pisa
Solved | Solution | Time |
---|---|---|
Dynamic Programming (O(N^2)) | TLE | |
:heavy_checl_mark: | Dynamic Programming (O(N)) | 56 ms |
The solution with dynamic programming proposed in this section use the recursion to find the result of the problme, and the recusion look like
To improve the solution we ca use a bottom up solution with the memorization technique based on the previus recursion, that save time complexity of the algorithm. It solution reduce the space complexity from O(N^2) to O(N) and it store the result inside an array.
The solution of the problem is in the last position of the array.