Skip to main contentArray Patterns
2- Pointer
- 2-Sum
- Rearrange the array in alternating positive and negative items
- 3-Sum
- 4-Sum
Sliding Window
While both the two-pointer and sliding window techniques use two pointers to traverse a data structure, they are not
exactly the same. Sliding window is a specific type of two-pointer technique where the pointers define a window of
elements, and this window is “slid” through the data structure.
Prefix Sum
- Longest subarray with a sum = K
- Count of subarrays with a given sum
- Largest subarray with a sum = 0
Matrix
- Set Matrix to zero
- Rotate a Matrix by 90, 180 and 270
- Spiral Traversal
Merge Sort
- Count Inversion
- Reverse pairs
Algorithms
- Dutch national flag
- Moors Voting Algorithm
- Moors Voting Algorithm(n/3)
- Kadane’s Algorithm with printing
- Next Permutation