L [ i ] = MaxSum ( L [ j ] ) + arr [ i ] where j < i and arr [ j ] < arr [ i ]
if ( arr [ i ] > arr [ j ] and ( len ( L [ i ] ) < len ( L [ j ] ) ) ) : NEW_LINE INDENT L [ i ] = L [ j ] . copy ( ) NEW_LINE DEDENT