Check if There Is a Valid Parentheses String Path

Solution Code

Time Complexity

O(nm(n+m)

Space Complexity

O(nm(n+m)