LeetCode-Easy-Valid Parentheses
###原题目
```cpp
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
```cpp
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Note that an empty string is also considered valid.
Open brackets must be closed in the correct order.
Note that an empty string is also considered valid.
Example 1:
Input: "()"
Output: true
Example 2:
Output: true
Example 2:
Input: "()[]{}"
Output: true
Example 3:
Output: true
Example 3:
Input: "(]"
Output: false
Example 4:
Output: false
Example 4:
Input: "([)]"
Output: false
Example 5:
Output: false
Example 5:
Input: "{[]}"
Output: true
```
###自己拿到题目第一想法
马上就想到可以用case但是没有看到最后一个例子,就是大括号包含括号的也可以,以为只能是第二个例子可行。所以目前的答案是错误的。
####自己看了solution之后的想法
在看了solution之后,发现这就是一个栈的数据结构问题,压栈出栈,中间各种条件判断
####问题总结
在这次的代码写作中,我觉得自己在考虑情况上面,十分的不足,对于情况的考虑不周全,比如这次开始就没有考虑到被当作栈的vector可以拿来当判断,空的string也是一个正确的答案,然后只有一个元素的反而不是,在又或者是最开始没有进行压栈的就是错误的。
很多条件都没有考虑到,应当进行反思。
Output: true
```
###自己拿到题目第一想法
马上就想到可以用case但是没有看到最后一个例子,就是大括号包含括号的也可以,以为只能是第二个例子可行。所以目前的答案是错误的。
####自己看了solution之后的想法
在看了solution之后,发现这就是一个栈的数据结构问题,压栈出栈,中间各种条件判断
####问题总结
在这次的代码写作中,我觉得自己在考虑情况上面,十分的不足,对于情况的考虑不周全,比如这次开始就没有考虑到被当作栈的vector可以拿来当判断,空的string也是一个正确的答案,然后只有一个元素的反而不是,在又或者是最开始没有进行压栈的就是错误的。
很多条件都没有考虑到,应当进行反思。