DP_solution in O(n^3) time complexity


#1

Just think in terms of MATRIX MULTIPLICATION DP.You will get the answer.


#2

NO, it gives only tle.


#4

There is also a O(n^2) solution, but that doesn’t satisfy always. So I opted for correct method which is O(n^3) time complexity and it ran correctly both here and on Leetcode.


#5

Times out 1 test case on leetcode. Maybe u used c++, I cant use that ,sorry.
Edit : It tles even in c++. I need to learn the N^2 solution.