Buying at the lowest price is the wrong first move in Best Time to Buy and Sell Stock.
On 5, 6, 2, 9, 1, 7, 0 the cheapest day comes last. Track the cheapest price so far and the best profit so far: one pass.
A hash set finds a linked list cycle in O(n) space. Then the interviewer asks for O(1).
One pointer steps once, one steps twice. If the list loops, the fast one always catches the slow one.
Every bracket in {[(])} has its pair, and the string is still invalid.
Counting brackets can't catch it. The bracket opened last has to close first, and that's exactly what a stack does.
Two Sum comes down to one question: for each number, have I already seen the one that completes it?
Keep a map of what you've seen and it's a single pass, O(n).
The full 9-minute walkthrough, with the sorted-array follow-up, is in the reply.