Two Sum
Problem Description
Easy
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.
Tags:
Arrays MathConstraints:
- Time Limit: 1000 ms
- Memory Limit: 128 MB
Sample Test Cases:
Example 1:
Input:
[2, 7, 11, 15] 9
Expected Output:
[0, 1]
Example 2:
Input:
[3, 2, 4] 6
Expected Output:
[1, 2]
Example 3:
Input:
[3, 3] 6
Expected Output:
[0, 1]