Dynamic Programming at work


#1

Here we are using dynamic programming to fill the matrix. So as we can see in the loops itself, the time complexity is O(R*C) as every cell is filled out only once (and whenever the recursive call needs to do a calculation again it just reads up that corresponding value in the designated cell we already calculated).