Tree
General template for various tree questions. Source
Inorder Traversal ```java public List
inorderTraversal(TreeNode root) { List list = new ArrayList<>(); if(root == null) return list; Stack stack = new Stack<>(); while(root != null || !stack.empty()){ while(root != null){ stack.push(root); root = root.left; } root = stack.pop(); list.add(root.val); root = root.right;
}
return list; } ```
NLP Glossary
Weird
Just weird code
Substring Problems
A general template for most substring problems taken from link.
Two Pointers
Problems
Ingenious Leetcode
A bunch of clever solutions to leetcode problems
Dynammic Programming
Practice Problems from DPV
BFS or DFS
Problems
Binary Search
Read MoreBacktracking
Backtracking recursion
Build up many possible solutions through multiple recursive calls at each step
Seed the initial recursive call with an “empty” solution
At each base case, you have a potential solution