dp [ i ] [ j ] be the longest subsequence of a [ 0. . . i ] with first j parts
dp = [ [ 0 for x in range ( n ) ] for y in range ( 4 ) ] NEW_LINE if arr [ 0 ] == 0 : NEW_LINE INDENT dp [ 0 ] [ 0 ] = 1 NEW_LINE DEDENT else : NEW_LINE INDENT dp [ 1 ] [ 0 ] = 1 NEW_LINE DEDENT