Initialising dp[i][j] to 0 may cause TLE! as there are apparently a lot of dp[i][j] with value 0 so initialise dp[i][j] to -1
Initialising dp[i][j] to 0 may cause TLE!
Thank you! Initializing with -1 stopped TLE error!
I still can’t understand why initializing with 0 gives TLE.