Dynamic Programming, Facebook Coding Interview, Google Coding Interview, Coding Interviews, Java.
diagonally aligned dp state dp[i][i] = 0 // single matrix don't have any cost of multiplicaton dp[i][i+1] = arr[i].rows * arr[i].cols*arr[i+1].cols len = 3 to arr.length i = 0 to arr.length - len j = i+len-1 dp[i][j] = for k in i to j-1 min(dp[i][k] + dp[k+1][j] +