If all the x - 1 previous elements have already appeared
if ( dp [ x - 1 ] [ 0 ] == cnt [ x - 1 ] ) : NEW_LINE INDENT dp [ x ] [ 1 ] = dp [ x - 1 ] [ 1 ] NEW_LINE dp [ x ] [ 2 ] = dp [ x - 1 ] [ 1 ] NEW_LINE DEDENT