Create 2D Matrix that stores dot product dp [ i + 1 ] [ j + 1 ] stores product considering B [ 0. . i ] and A [ 0. . . j ] . Note that since all m > n , we fill values in upper diagonal of dp [ ] [ ]
dp = [ [ 0 for i in range ( m + 1 ) ] for j in range ( n + 1 ) ] NEW_LINE