Decide whether a string of brackets ()[]{} is well-formed — every opener closed by the same type, in the correct nesting order. Two approaches, same problem — switch between them and watch how time and space trade off.
()[]{}