Correct (exponential recursive) solution to Longest Valid Parentheses (Leetcode)