update longest valid parentheses problem

add a dp way