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
dp = [ [ 0 for i in range ( n ) ] for i in range ( n ) ] NEW_LINE