Facebook | Onsite | Dot product of sparse vectors

Suppose we have very large sparse vectors (most of the elements in vector are zeros)

  1. Find a data structure to store them
  2. Compute the Dot Product https://leetcode.com/problems/dot-product-of-two-sparse-vectors/ (premium)

Follow-up:
What if one of the vectors is very small?

Comments (35)