// TOPIC

#arrays

9 articles

Beginner
01

Arrays and How Memory Really Works

Go under the hood of the most fundamental data structure — contiguous bytes, O(1) index addressing, cache lines, and why a sequential scan beats a random walk every time.

#arrays#memory#fundamentals
8 min
BeginnerAmazonGoogle
02

Strings

Strings look like simple text, but they hide a brutal trap: naive concatenation in a loop is O(n²). Learn why, how encoding actually works, and the handful of patterns — sliding window, two pointers, hashing — that solve 80% of string interview problems.

#strings#arrays#fundamentals
12 min
BeginnerAmazonGoogle
03

Arrays

The data structure everything else is built on. Why arr[i] is instant, why inserting in the middle hurts, and the handful of patterns that turn arrays into interview wins.

#arrays#fundamentals#data-structures
6 min
◆◆IntermediateAmazonGoogle
04

Prefix Sums

Precompute running totals so any range sum becomes one subtraction. The prefix sum technique turns O(n) per query into O(1) — and the hashmap combo unlocks a whole class of subarray counting problems.

#arrays#prefix-sums#techniques
10 min
◆◆IntermediateAmazonGoogle
05

Monotonic Stacks

The monotonic stack is the O(n) trick for finding the next greater or smaller element — a sorted stack you maintain on the fly, with one deceptively simple pop-while loop at its core. Used in Daily Temperatures, Largest Rectangle in Histogram, and Trapping Rain Water.

#monotonic-stack#stack#arrays
12 min
◆◆IntermediateAmazonGoogle
06

The Merge Intervals Pattern

Sort by start, sweep and merge — the one instinct that cracks meeting rooms, calendar conflicts, and range overlap problems in O(n log n). Master the overlap test and you'll recognize this pattern before you finish reading the problem statement.

#intervals#sorting#greedy
10 min
◆◆IntermediateAmazonMeta
07

Cyclic Sort

The O(n) time, O(1) space trick for arrays that hold numbers in a known range 1..n: place each value at its natural index, then scan once for anything out of place. Missing numbers, duplicates, and corrupt pairs fall out as a natural consequence.

#arrays#sorting#patterns
10 min
◆◆IntermediateAmazonMeta
08

The Two Pointers Pattern

A sorted array and an O(n²) instinct — two indices, moving in tandem, collapse it to O(n). Here is the pattern, the tell that signals it, and every problem variant you will see.

#two-pointers#arrays#sorting
10 min
◆◆IntermediateAmazonGoogle
09

The Sliding Window Pattern

Learn the sliding window technique to solve "longest/shortest/contains" subarray and substring problems in O(n) instead of O(n²). Covers fixed and variable windows, the expand-right-shrink-left template, and the classic bugs.

#sliding-window#two-pointers#arrays
10 min