These are the stack and queue problems every placement candidate should be able to solve, from a plain bracket check to the largest rectangle. Name the structure first: a stack for nested or newest-first work, a monotonic stack for nearest bigger or smaller items, and a deque for lines and windows. Trace a small input, then check your program on every test.