Algorithm · Meta · Medium
This challenge has two parts. The first one is about representing and combining sparse data; the second one is about locating connected components inside a grid. Part 1: Dot Product of Sparse Vectors You are handed two integer arrays a and b that share the same length. Both arrays are sparse: the overwhelming majority of their entries are zero. Compute the dot product, that is, the sum of a[i] * b[i] taken over every index i. Because a position contributes only when both…
Checking your access…