Skip to main content
Skill ForgeSkill Forge

Demo mode · fictional sample content

Adaptive pick · Two pointers

Two pointers

Two indices walk the array — often one from each end, or one fast + one slow. Perfect for pair-sum, in-place dedupe, and partitioning problems.

Teach

To reverse a string with two pointers, start one index at each end and swap the characters, then step both inward until they meet (i++, j--). O(n) time, O(1) extra space — the same converging-pointer pattern behind pair-sum on a sorted array and in-place partitioning.

Like the loop? Generate a curriculum tuned to your goals.