NeetCode #159LC-1570MediumArrays & Hashing
← Back to All Problems#159 · #1570 · Dot Product of Two Sparse Vectors(两个稀疏向量的点积)
📌 Problem Statement & Constraints
Design a class that computes the dot product of two sparse vectors. The constructor takes
nums, and dotProduct(vec) returns the dot product with another sparse vector. Constraints: 1 <= nums.length <= 10^5, 0 <= nums[i] <= 100; the number of non-zero elements is small.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!