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.

Practice More Questions

No answers yet

Be the first to share your approach to this question

Interview question asked to Production Engineers, Software Engineers, Engineering Managers and other roles interviewing at Qualys, Plaid, Accenture and others: Two Sum.