Should you be MEMORIZING solutions, or, expecting yourself to come up with the O(N)/O(1) solutions on your own?
Should you be MEMORIZING solutions, or, expecting yourself to come up with the O(N)/O(1) solutions on your own?
You don't need to memorize since 1.) you don't know what parts of the problem will generalize to other problems until you've seen a lot of problems, 2.) by the time you're able to recognize the same pattern repeated in other problems, you've mostly memorized it anyway.
What I've found to be the most helpful is taking down notes of new concepts that I've learned. For example, a quick summary of how dijkstra's algorithm works so if I need to use it, I can read my own summary and quickly get up to speed on it.
Trust me, I understand that in the real world that's exactly how you would approach these problems.