不管哪种方法,如果 长度是奇数,直接返回false
注意括号交错要返回False
一种映射方法是只把右括号push入栈
时间复杂度 O(n)
空间复杂度 O(n)
这是最容易想到的方法
Last updated 4 years ago