A parentheses string is a non-empty string consisting only of '(' and ')'. It is valid if any of the following conditions is true:
().AB (A concatenated with B), where A and B are valid parentheses strings.(A), where A is a valid parentheses string.You are given an m x n matrix of parentheses grid. A valid parentheses string path in the grid is a path satisfying all of the following conditions:
(0, 0).(m - 1, n - 1).Return true if there exists a valid parentheses string path in the grid. Otherwise, return false.
m == grid.lengthn == grid[i].length1 <= m, n <= 100grid[i][j] is either '(' or ')'grid = [["(","(","("],[")","(",")"],["(","(",")"],["(","(",")"]]truegrid = [[")",")"],["(","("]]false