Five minutes. One pattern. Stay fluent.

Daily etudes

Two Sum

Pattern: Hashmap. Five to ten minutes.

Given an array of integers nums and an integer target, return the indices of the two numbers that add up to the target.

There is exactly one solution. You may not use the same element twice. Indices are 0-based.

Pattern: hashmap — remember each value’s index while you scan once.

Fill in the function. Log in to run sample tests or submit.