Problem Statement
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.
You must return the answer in ascending order.
Input Specification
The first line of the input gives the number of test cases, , test cases follow.
Each test case consists of two lines. The first line of each test case contains the target integer .
The second line contains the elements of the list , separated by spaces.
Limits
Memory limits: 32MB.
Time limits: 1 second.
Test Set 1
Sample Case.
Test Set 2
Test Set 3
Test Set 4
Output Specification
For each test case, output one line containing Case #x: y
, where is the case number (starting from 1), and is a list of the two indices in the given list that add up to the target, enclosed in square brackets and separated by a space. The indices must be in ascending order.
Sample Input
2
9
1 2 3 4 5
16
2 4 6 8 10
Sample Output
Case #1: [3, 4]
Case #2: [2, 4]
Hint
for-loop
if-else
Comments