If input array is sorted then
- Binary search
- Two pointers
If asked for all permutations/subsets then
If given a tree then
If given a graph then
If given a linked list then
If recursion is banned then
If must solve in-place then
- Swap corresponding values
- Store one or more different values in the same pointer
If asked for maximum/minimum subarray/subset/options then
If asked for top/least K items then
If asked for common strings then
Else
- Map/Set for O(1) time & O(n) space
- Sort input for O(nlogn) time and O(1) space