There is a bug in this problem


the memo cache has a fixed size while R and C are variables.
As soon as c >= 101, you are accessing a memory location you do not intend to access. for r=0 and c = 101, you are actually accessing memo[1][0].
As soon as r=101, you are out of bound.


Memo Pad is always made before knowing the constraints on R and C values at the starting of the question. Some constraints would always be given at the start on R and C so that we can make our algorithm accordingly