Ad
  • Custom User Avatar

    I'm having the same issue where I feel the instructions aren't well clarified (I wrote a separate comment about it above). Could you help define it? I'm confused as to why "([{}])" would return true but "[(])" would return false

  • Custom User Avatar

    You could also inductively define valid strings like so:

    1. The empty string is valid. (e.g. "")
    2. If x and y are both valid strings, then xy is a valid string. (e.g. x: "()" y: "[]" xy: "()[]")
    3. If x is a valid string, then (x), [x] and {x} are all valid strings. (e.g. x: "()[]" also valid: "(()[])", "[()[]]", "{()[]}")

    This matches the current requirements while also being precise.