用栈的思想。
class Solution {
unordered_map map={
{')', '('}, {']', '['}, {'}', '{'}
};
public:
bool isValid(string s) {
vector vec;
for(int i=0; isecond==vec[vec.size()-1]){
// cout << vec[vec.size()-1] << "出" << endl;
vec.pop_back();
}else{
return false;
}
}
if(vec.size()==0){
return true;
}else{
return false;
}
}
}; 


