I need your help
So I have linear array and elements are sorted form lowest to highest.
I just need algorithm that returns indexes if arr[i]-arr[j]=160.
Runtime should be O(n).
help me /sci/ you're my only hope
>create a second array b where b[i] = a[i]+160
>merge the two arrays in one ordered array (since the two subarrays are already ordered this is linear)
>check for duplicates (they are always adjacent)
>the original indexes of the two elements (one coming from a and one from b) are the j and i you were looking for
This obviously run in O(n).
I'll let you work out the implementation.
return (high, low)