I am going to list here some of the most commonly asked LC-style question patterns.
Graphs
For me, almost 90% of the time I have been asked graph based questions. Lets see some of the patterns in these.
DFS
Most of the graph based and backtracking based problems can be solved with DFS.
Common lookout patterns appear to be:
-
Coverage based - Given grid -> find covered area. Max Area of Island
-
Tracing a path - Given grid -> find locations in the trace. Pacific Atlantic Water Flow
-
Directed graphs - Given connections -> find if path possible. Course Schedule II
-
Cycle Detection in a directed/undirected graph. Redundant Connection
Other must do questions:
- Number of Connected Components in an Undirected Graph
- Clone graph
- Graph Valid Tree
BFS
This one is a bit tricky and most of the times in the past, I have been able to identify a graph problem but structuring it into bfs or dfs can be tricky.
Common lookout patterns appear to be:
- ānā goals/distance to ānā goals - Given grid and n no. of goals -> get least distance to each cell. Islands and Treasure
- Minimum time t type (variant of 1) - Given grid and n no. of goals -> get least time to cover cells. Rotting Fruit