Efficient Data Structure for Dot Product of Run-Length Vectors

Design an efficient data structure to represent vectors and compute the dot product of two vectors. The vectors contain long runs of consecutive repeated values, e.g. the dot product of `[4,4,4,4,...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: