We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 225e022 commit 9a1a71bCopy full SHA for 9a1a71b
solution/1500-1599/1570.Dot Product of Two Sparse Vectors/Solution.cpp
@@ -1,15 +1,15 @@
1
class SparseVector {
2
public:
3
unordered_map<int, int> d;
4
-
5
- SparseVector(vector<int> &nums) {
+
+ SparseVector(vector<int>& nums) {
6
for (int i = 0; i < nums.size(); ++i) {
7
if (nums[i]) {
8
d[i] = nums[i];
9
}
10
11
12
13
// Return the dotProduct of two sparse vectors
14
int dotProduct(SparseVector& vec) {
15
auto a = d;
0 commit comments