← Back to TypeScript
Arrays and Strings
Two pointers, a sliding window, a running sum — the three shapes most interview array questions reduce to, practised as code you can hold in your head.
Two pointers on a sorted array
intermediateblankComplete the two-pointer scan that finds the pair summing to a target in one pass, without nested loops.
Challenge: longest span without a repeat
advancedchallengeFind the length of the longest substring with no repeated character, in one left-to-right pass.
Challenge: range sums in constant time
intermediatechallengePrecompute prefix sums once so every range-sum query is a single subtraction.
Review: two-sum that pairs an element with itself
intermediatereviewA hash-map two-sum passes every test except the one where the answer is the same value twice. Find the one line in the wrong place.
Kadane's scan for the best subarray
intermediateblankComplete the one-pass maximum subarray sum — the running sum that either extends or restarts at every element.