Sign In Required

You need to sign in to access this feature and track your progress.

Easy

Two Sum

Topic: Arrays & Hashing • Acceptance: 81%
Given an array of integers `nums` and an integer `target`, return indices of the two numbers such that they add up to `target`. You may assume that each input would have exactly one solution, and you may not use the same element twice.

Input Format:

First line contains n (array size). Second line contains n integers. Third line contains target.

Output Format:

Print the two 0-indexed indices separated by space.

Sample Example:

Sample Input:
4
2 7 11 15
9
Sample Output:
0 1
Sandboxed Engine

Ready to test. Click Test All Cases or Submit Solution to evaluate your code.

Code Playground Cloud Sandbox PYTHON
// Code Playground Cloud Execution Engine v2.4
// Write your code and click 'Run Code' to execute.
$ ready
Standard Input (stdin):
Your code can read standard input via stdin.