Write a function areCurlyBracesMatched that takes in a string s containing only { and/or } and returns true if s is properly matched, and false otherwise.
For this challenge the string can only contain '{' or '}', so your example is not a valid input.
It's obvious that it can't be resolved with a regexp for the general case.
Another one line JS solution
You made a typo:
Math.flor
should beMath.floor
. Otherwise good take at using a regular expression. Unfortunately, it does not work for cases likeAs the curly braces are separated by other characters.
For this challenge the string can only contain '{' or '}', so your example is not a valid input.
It's obvious that it can't be resolved with a regexp for the general case.
Smart! I like it!