diff --git "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\220\210\346\263\225\346\213\254\345\217\267\345\210\244\345\256\232.md" "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\220\210\346\263\225\346\213\254\345\217\267\345\210\244\345\256\232.md" index 60526e3aad6bcd92626bfe82c6eea3aaf3562174..a7e42631bfbc45a25f5a8eb4494219f416c42425 100644 --- "a/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\220\210\346\263\225\346\213\254\345\217\267\345\210\244\345\256\232.md" +++ "b/\351\253\230\351\242\221\351\235\242\350\257\225\347\263\273\345\210\227/\345\220\210\346\263\225\346\213\254\345\217\267\345\210\244\345\256\232.md" @@ -85,32 +85,6 @@ char leftOf(char c) { ![labuladong](../pictures/labuladong.jpg) -[labuladong](https://github.com/labuladong) 提供 C++ 解法代码: - -```cpp -bool isValid(string str) { - stack left; - for (char c : str) { - if (c == '(' || c == '{' || c == '[') - left.push(c); - else // 字符 c 是右括号 - if (!left.empty() && leftOf(c) == left.top()) - left.pop(); - else - // 和最近的左括号不匹配 - return false; - } - // 是否所有的左括号都被匹配了 - return left.empty(); -} - -char leftOf(char c) { - if (c == '}') return '{'; - if (c == ')') return '('; - return '['; -} -``` - [张三](any_link_you_want) 提供 Java 代码: ```java @@ -135,4 +109,4 @@ def isValid(str): [下一篇:如何寻找消失的元素](../高频面试系列/消失的元素.md) -[目录](../README.md#目录) \ No newline at end of file +[目录](../README.md#目录)