coding interview cheat sheet
cheat sheets
best one: * [nang downloaded cheat sheet](file:///D:/Downloads/CodingInterviewPrepMaterials/CheatSheet.pdf)
- data structures nice looking cheat sheet with animations looks like they took down the animations..
- interview sheet
- leetcode cheat sheet
if given a sorted array:
- binary search
- two pointer
if given tree or graph
- DFS
- BFS
if asked for permutations / subsets:
- backtracking
if given a linked list:
- two pointer
if recursion is banned:
- stack
if asked for min/max subarray/subset/options:
- dynamic programming
if asked for top/least k items:
- heap
if asked for commong strings
- map
- trie
if need to keep count of distinc elements:
- hash map
- set
else:
- map/set for O(1) time and O(n) space
- sort input for O(nlogn) time and O(1) space.