Intermediate · Coding exercise
Find two indices with a target sum
hashing · arrays
Guest practice stays in this visit. Sign in to save your progress. Checks cover the stated cases; discussion rubrics are self-reviewed. These tasks do not mark course lessons complete.
BuildFind two indices with a target sum
Implement two_sum(values, target) for integers. Return indices [i, j], with i < j, for the earliest j that completes a pair; use the earliest eligible i. Return [] if no pair exists. Do not reuse an index.