Ad
  • Custom User Avatar

    To add on, I think it's also because the pair of brackets will only be replaced with "" if the open and close brackets are in the correct order, of the same type as well as next to each other, on each iteration. By the last iteration, it should give you a "" if the bracket orderings are valid.

  • Custom User Avatar

    It's regex knowledge rather than code knowledge.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    I was wondering if someone could explain how this works, particularly if braces are out of order? For instance, if braces was "({[}])", wouldn't this code change the string to "{[}]", then to "{}"? Wouldn't this disregard the order of braces? I'm relatively new and would greatly appreciate if someone could help me out. Thanks!

  • Custom User Avatar

    Respect to the author! I hope one day I can code as well as this.