Initial attempt to solve longest parentheses validation, O(n^2) which is too slow to pass large data set.