Media.net·Software Engineer·Technical Phone Screen
- Given an array of N numbers and a target T, find a contiguous subarray whose sum is closest to T. Then handle M different values of T efficiently.
“My first instinct was prefix sums plus binary search, which gets you to O(N log N) per query.”