foundation
Arrays and strings tasks
Common scan, transform, frequency, two-pointer, and substring patterns in coding interviews.
Arrays and strings tasks often combine simple iteration with one extra idea: two pointers, a frequency map, prefix state, stable partitioning, or normalization. Start with a brute-force baseline, then explain which repeated work the optimized pattern removes.
Trade-off: compare time, memory, and implementation complexity before committing to a structure or pattern.
On interviews: Interviewers expect clean edge cases: empty input, casing, Unicode assumptions, duplicates, sortedness, and whether output order must be preserved.
Common pitfalls: Do not optimize before locking the requirements. String indexing can be tricky with Unicode, and in-place array changes can violate immutability expectations in application code.
Checklist:
- Write brute force first.
- Identify repeated work.
- Clarify order and mutation.
- Test empty and duplicate cases.