var isValid = function(s) {
let res = s;
while (res.indexOf('()') !== -1 || res.indexOf('[]') !== -1 || res.indexOf('{}') !== -1) {
res = res.replace('()', '');
res = res.replace('[]', '');
res = res.replace('{}', '');
}
return !res;
};
O(n)
o(n^2)