LIFO problems: bracket matching, spans, and nearest-element queries.
Decide whether every bracket is correctly opened and closed.