DSA Revision
Arrays
Concept summary
- Prefix sums, two pointers, sliding windows, and hashing solve most array patterns.
- Start with brute force, then name the repeated work or invariant.
- Always finish with time complexity, space complexity, and edge cases.
prefix[i] = prefix[i - 1] + arr[i]
Key patterns to remember
State the invariant before coding
Dry run on a tiny input
Track edge cases explicitly