Balanced brackets not up to Rosetta standard

Balanced brackets not up to Rosetta standard
0

#1

In the examples you tell us that “][” should return FALSE
In test #5 you show that “][” should return TRUE.

Also, the Rosetta testcase (that you copied) says the brackets should occur “in that order”, .i.e. ‘[’ then ‘]’.,
so any testcase beginning with a ‘]’ should fail.

You guys blew this one.

Your code so far


function isBalanced (str) {
  // Good luck!
  let cnt = 0;

  for(let x=0; x<str.Length; x++) {
    if( str[x] == '[')
      cnt++;
    else if  (str[x] == ']')
      cnt--;
      
         //if( cnt<0)    // commented out because FCC thinks "][" is valid
      //break;
  }

if(cnt == 0)
  return true;
else
  return false;  
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/coding-interview-prep/rosetta-code/balanced-brackets


#2

I’m going to let you in on a secret about being a developer: no one likes jerks. If your idea of constructive criticism is “you guys blew this one”, then I hope you’re comfortable with your station in life because you’ll be basically unhireable.

The problem you describe would be a simple fix. If you feel like being a positive force in the community, you can find an issue, or clone the repo and fix it yourself.


#3

Nice use of your Leader status Greg. If you can’t take any negativity or criticism in your life, you’re going to fail hard.

Yes, it’s probably an easy fix but I’m seeing a trend in how fCC rolls things out and I’d like to see them do better.

Because, how would you feel as a new developer to figure out a problem like this, and then have your answer rejected even though you did everything right?


#4

Way to project. I didn’t say you were wrong, but that the way you went about submitting your criticism was. Negativity isn’t something you should feel entitled to give just because you hit a slight inconvenience.

How would you feel if you volunteered your time to an online project that helps thousands of people learn new skills, and then have a simple error pointed out with, “you blew it”. Despite whatever you’ve learned from your role models, it is possible to offer criticism without the attitude. My advice is to learn the difference or find another path in life. Take it or leave it, but if you can’t see what you did wrong, then don’t make any more posts here.

I’m locking this thread because you’re clearly not interested in being constructive.


#5