Question:
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.
MyAnswer 1 (C++):
1 class Solution { 2 public: 3 bool isValid(string s) { 4 char stack[s.size()]; 5 int i = 0; 6 int j = 0; 7 8 //cout << s; 9 10 if(s[j] == ')' || s[j] == ']' || s[j] =='}') 11 return false; 12 else if(s[j] == '