Dot Product of Two Sparse Vectors

Given two sparse integer vectors nums1 and nums2 of equal length, implement their dot product:

sum(nums1[i] * nums2[i]).

Most elements of a sparse vector are zero. Design a representation that...

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: