For simplicity of the program , one extra row and one extra column are allocated in dp [ ] [ ] . 0 th row and 0 th column of dp [ ] [ ] are not used
var dp = Array . from ( Array ( n ) , ( ) => Array ( n ) ) ;