Two Sum

MediumGrade 11

Read an array and a target value. Find the two DIFFERENT indices whose values add up to the target, and print them (smaller index first). Assume exactly one valid pair exists.

Input / Output

Input: first line N, second line N space-separated integers, third line the target. Output: the two 0-based indices, smaller first, space-separated.

Examples

Input

4
2 7 11 15
9

Expected Output

0 1

Input

3
3 2 4
6

Expected Output

1 2

+ 2 hidden tests checked on Submit.

Files

Main.java is the entry point. Add extra classes for OOP exercises — they compile together.

Main.java
Loading...

Run your code to see test results here.