AAlgoLoopSpaced repetition for LeetCode

Sorting

Sorting arranges data so that order-dependent logic — deduping, grouping, two-pointer sweeps, greedy choices — becomes simple. The sort itself is O(n log n); the skill is recognizing that ordering the input first makes the rest easy.

2 LeetCode problems solved with the Sorting pattern. Practice them with spaced repetition so the pattern sticks.

See the full solution

The complete approach, reference solutions in 5 languages, and a step-by-step visualization — then add this problem to your spaced-repetition schedule.

Start free →