http://oj.leetcode.com/problems/valid-parentheses/
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not.
思路:
用一个堆栈保存左括号然后匹配即可。
1 class Solution { 2 public: 3 bool isValid(string s) { 4 stack<char> left_pars; 5 const char *p = s.c_str(); 6 7 while (*p != '