sitting with a hard problem.
olympiad training and exams doesn’t really teach you tricks. the exam questions dont have a pattern. you dont have a data structure or algorithm that you learned in DSA class that conveniently fits each question. no, it teaches you to stay in the room with a problem long after it stops being comfortable, to keep turning it over when the obvious moves are gone.
i’ve found that that habit turns out to be most of debugging.
a bug you can’t explain is just a proof you haven’t finished. the temptation is to change things until the symptom disappears; the discipline is to keep asking why until the mechanism is obvious. same move as a geometry problem: don’t guess the construction, understand why it has to be that one.
two things i try to hold onto:
- state what you actually know, separately from what you assume. half of hard problems dissolve once those two piles are really separate.
- find the smallest case that still fails. in maths it’s a base case; in code it’s a minimal repro. either way, the small version tends to tell the truth.
none of this was fast. but “fast” was never the goal — right was, and right tends to be fast on the second pass.