Coding

Two Sum

You're presented with an array of integers and a specific target value. Your task is to identify and return the indices of two numbers from the array that add up to the target. You can assume there's exactly one solution, and you can't use the same element twice. The indices can be returned in any order.

Input: nums = [14,8,22,6], target = 20

Output: [1,3]

Explanation: The integers at indices 1 and 3 (8 and 6) sum up to 20, so we return [1, 3].

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

Community Answers

1 answer from the community

Unlock Full Access

Answer any un-answered question from our database to unlock all community answers for 30 days.

Give & Take

Practice More Questions

2 answers published. Last candidate submission on Sep 23 2026, 12:33pm PDT. Interview question asked to Machine Learning Engineers, Software Engineers, Production Engineers and other roles interviewing at Mollie, SoFi, PayPal and other companies. Original question asked: Two Sum. Question last reported by a candidate interviewing at Dell for a Machine Learning Engineer interview on Sep 20 2026, 4:51pm PDT.