Array
1385. Find the Distance Value Between Two Arrays
The condition on arr1[i] reads as a statement about all of arr2, but it only ever depends on one element of it. Sort arr2, call the value x, and ask for the first element that reaches x - d. Everything before that element is below the window by construction; everything after it is at least as large.
Loading…