Algorithm · Bloomberg · Easy
Problem You are given a strictly increasing integer array boundaries of length m and an arbitrary integer array arr. For each value x in arr, assign it to the half-open interval defined by two consecutive boundaries: boundaries[i] ≤ x < boundaries[i+1] When x satisfies this for some i, it falls into bucket i. Count how many elements of arr end up in each bucket and output those counts. Values that lie outside the covered range are discarded: If x < boundaries[0] or x ≥…
Checking your access…