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
0
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.
Answered by
16
The first step is to sort the array in ascending order. ... if (i != j && arr[j]- arr[i] == n).
thanks me Later ❤️
thanks me Later ❤️
Similar questions
Math,
7 months ago
Social Sciences,
7 months ago
Science,
7 months ago
English,
1 year ago
Physics,
1 year ago