返回首页
有效的括号
LeetCode Hot 100
栈
难度:
简单
题目描述
判断字符串中的括号是否匹配。
解题思路
使用栈,遇到左括号入栈,遇到右括号检查栈顶是否匹配。时间复杂度为 O(n)。