Ad

Remove validate from the test cases, it overwrites user code and a single semicolon will pass all tests (and, which is more problematic, completely wrong code works as well.)

Code
Diff
  • ;
    • const validate = str => {
    • let acc = 0;
    • for (let i = 0; i < str.length; i += 1) {
    • acc = str[i] === '(' ? acc + 1 : acc - 1;
    • if (acc < 0) return false;
    • }
    • return acc === 0;
    • };
    • ;