- Single source shortest path on unweighted graphs - Use BFS ( DFS can be used for trees.)
- A graph is a tree if it has 1 connected component and no of edges is n-1.
- Min distance between two node in binary tree. Find LCA. (https://ideone.com/FNZSfD)
- If it is a grid question,check if dfs or bfs can help.
- While taking mod, use (n+mod)%mod . It will take care of negative values of n.