← Microsoft questions

Solve the Two Sum problem using hash maps

Filed under Microsoft

Given an array of integers and a target sum, return the indices of the two numbers such that they add up to the target. Use a hash map to achieve linear time complexity.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.