Given an unsorted array of integers, find the first pair with given sum in it. Return the index for these integers.

When the solution is called with the following input `arr = [8, 7, 2, 5, 3, 1]`

, `sum = 10`

, it is expected to return `[0, 2]`

. `arr[0]`

holds the value 8 and `arr[2]`

is 2. `8 + 2 = 10`

which is the desired sum value.

Contributed by Murat Sütunç

You are not signed in. You can only run/submit code after signing in. Create your free Codela account now!