We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
原题链接:https://leetcode-cn.com/problems/valid-parentheses/
解题思路:
/** * @param {string} s * @return {boolean} */ var isValid = function (s) { // 计算可能的括号对数 let len = s.length / 2; // 每次循环替换掉一组括号 for (let i = 0; i < len; i++) { s = s.replace(/(\(\))|(\[\])|(\{\})/, ''); } // 如果字符串不为空,表示有非成对括号 return s.length ? false : true; };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
阅读更多系列文章请访问我的GitHub 博客
原题链接:https://leetcode-cn.com/problems/valid-parentheses/
解题思路:
The text was updated successfully, but these errors were encountered: