They definitely are asking puzzle question that an university teacher teaching algorithm would fail. And the only way to is practice stupid question on leetcode
You grind leetcode problems over and over so that you can better recognize these patterns and know when to apply their associated solutions.
The most idealistic scenario is you get a problem you've recently practiced verbatim. Then you just put on an act like you've never seen it before in your life.
But if you get a problem that you can match to a pattern you've practiced, then you're still mostly in a good place.
As an aside, to everyone who has asked me how to get into FAANG - I always say you should be able to code DFS/BFS in your sleep like your life depends on it. 1/5 questions is surely going to be a tree/graph search.
Example:
Breadth first search
Recursion
Binary Tree
Etc.
Then it’s more a classification problem.