Ask HN: How to Approach Algorithm Studying?
Generally, I can intuit the "brute force" solution, but the "right" answer with linear/constant time often requires looking at the answer.
Should I expect that with practice, I'll eventually get better at quickly finding the optimal solution? Or, is it expected that optimal solutions are "memorized" similar to how hard sciences like ME / EE / CE memorize formulas?
Take ThreeSum problem for example. I was able to write the brute force solution without any prior knowledge of the problem. In an interview with time constraints this WOULD have been my solution.
I now understand that's not the right solution. I've looked at the answer, and I have the "right" solution memorized. That kind of feels like cheating though Should I have been able to write that "right" solution straight away, with no prior exposure to the problem?
Just trying to understand what my goal is in this process, and what is considered "success" for my studies.