Light Mode
Dark Mode
task Brackets

Why my solution got Error: 12,37: ')' expected. function should return True or False ? I ran this function in browser with your examples and all works

function brackets(expr: string): boolean {

let d = expr.replace(/([+=/*-])/g, '').replace(/[0-9]/g, '');

while(d.includes('[]') || d.includes('{}') || d.includes('()')){
    d = d.replace('()', '').replace('{}', '').replace('[]', '');
}

return d == ''; }

Created: May 1, 2020, 1:34 p.m.
Updated: May 6, 2020, 3:24 a.m.
0
14
User avatar
andoreyrich