Interview Intel

I'm stuck. Should I look at the solution?

When to keep thinking, and when to look.

63

Not yet, but not never either, because the struggle is the training and skipping it teaches you almost nothing, so the real question is knowing when to stop. The usual rule, stuck for N minutes and then open the solution, is the wrong one, because a clock has nothing to do with whether more thinking will actually get you anywhere. Open the solution by decision instead, based on whether you still have anything left to try, and treat an editorial as a fixed amount of insight that you only get to spend once: if you still have ideas to try, or you feel close, keep going, and if your list of things to try is genuinely empty, or you are about to give up and forget the problem rather than work on it, then reading it is worth more than the struggle you have left. ko_osaga put this well on Codeforces:

ko_osaga on the right way to use editorials

When you do read it, do not just nod along and move on, because you understand a solution the instant you see it and that is not at all the same as being able to produce one. Close the editorial, rebuild the solution yourself from scratch, and then come back a few days later and solve a variant with one constraint changed, because that last part is what actually makes it stick.

WhiteBox Guides