Pretty much most senior level/grad algorithm classes are like this. They introduce a framework for solution and then give you about 2-3 example lecture problems that they walk you through. 2-3 weeks after being introduced to 5/6 frameworks its Exam day. You are given unique word problems that, in the eyes of someone experienced like a prof or PhD student, is trivial. But you are struggling with 1 week of homework exp…
I did well in Algorithms courses (I took 4-5 and TA’d the intro class). I also studied math on top of CS. Imo a lot of the problem that CS students face in algorithms is due to not having a mathematical background. Even though you are introduced to concepts like invariants, induction, and propositional logic in a discrete math class, IMO it takes more exposure and practice to get to the point where these concepts get…
There's a lot of babbling about how coding is the limiting factor, but it really isn't. What people struggle with is solving the problems in their head. Writing the actual code after you've done that is almost trivial.
Another angle is how you need to think in abstract terms in the solution space. Most people whose knowledge of algorithms is weak think like: "okay, the problem says the word 'array' so I probably need a quicksort here". People who are successful think like "if this array were sorted, I could search an element in O(lg n) time instead of O(lg n). Can I solve the problem with this additional hypothesis?".
It's almost like being a chess player: when you're weak you come up with moves and hope they work, when you get stronger you look at a position and come up with plans and reasons why certain moves will or will not work.
The top-down mode of thinking is how you write a solution but not how you come up with one, the actual process is more "inside out", you find out stuff thinking about the problem and then you connect the dots.
Part of it is just experience and wit, but much can be taught, and formal mathematics helps the most.