Submit solution


Points: 10 (partial)
Time limit: 1.0s
Memory limit: 32M

Authors:
Problem type
Allowed languages
Python

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, T, T test cases follow.

Each test case consists of two lines. The first line of each test case contains the target integer t.

The second line contains the elements of the list L, separated by spaces.

Limits

Memory limits: 32MB.

Time limits: 1 second.

1 \leq T \leq 100

2 \leq \text{length of L} \leq 100

Test Set 1

Sample Case.

Test Set 2

2 \leq \text{length of L} \leq 10

Test Set 3

2 \leq \text{length of L} \leq 50

Test Set 4

2 \leq \text{length of L} \leq 100

Output Specification

For each test case, output one line containing Case #x: y, where x is the case number (starting from 1), and y 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

Ref

https://leetcode.com/problems/two-sum/


Comments

There are no comments at the moment.