Common techniques for coding problems
reference
- Sliding window
- Two/three-pointer
- Recursion, DFS, BFS, DP
- Interval problems (insert, merge)
- Linked lists (reverse, find dups, etc.)
- Prefix sum
- Binary search
- Bit manipulation (sum of 2 integers, is power of 2)
- Anagram:
- Sort strings → O(NlogN) time, O(logN) space
- Frequency counting of characters → O(N) time, O(1) space
- Palindrome:
- Is reverse equal to self
- Expand pointers from the center (i,i) for odds, (i, i+1) for evens
- Use DP for subsequences
See also some Funky Big-O complexities.
Links to this note
Framework for coding interviews
Having a framework by which you approach every single technical interview greatly improves your chances of success. It can’t help you have a perfect session, but almost guarantees you will...
Tech interview resources
tl;dr; This applies to Big Tech and other companies who are applying similar interviewing strategies. - Spend 2 weeks reading “Cracking the Coding Interview” and familiarizing yourself with the process....