Math, asked by Lakshyatomar50, 1 year ago

Given an array a of sorted integers and another non negative integer k, find if there exists 2 indices i and j such that a[i] - a[j] = k, i != j.

Answers

Answered by Anonymous
0
\mathfrak{The\:Answer\:is}



Given an array a of sorted integers and another non negative integer k, find if there exists 2 indices i and j such that a[i] - a[j] = k, i != j.


\boxed{Hope\:This\:Helps}
Answered by IMDILJAAN
16
The first step is to sort the array in ascending order. ... if (i != j && arr[j]- arr[i] == n).

thanks me Later ❤️
Similar questions