$dp [ $n + 1 ] [ $m + 1 ] ; Fill entries in bottommost row and leftmost columns
for ( $ i = 0 ; $ i <= $ n ; $ i ++ ) $ dp [ $ i ] [ 0 ] = 1 ; for ( $ i = 0 ; $ i <= $ m ; $ i ++ ) $ dp [ 0 ] [ $ i ] = 1 ;