longest valid parentheses leetcode, very tricky