package com.fishercoder.solutions;

public class _1570 {
    public static class Solution1 {
        class SparseVector {
            int[] vector;

            SparseVector(int[] nums) {
                this.vector = nums;
            }

            // Return the dotProduct of two sparse vectors
            public int dotProduct(SparseVector vec) {
                int[] incoming = vec.vector;
                int dotProduct = 0;
                for (int i = 0; i < vector.length; i++) {
                    dotProduct += incoming[i] * this.vector[i];
                }
                return dotProduct;
            }
        }
    }
}

@@ -86,16 +86,239 @@
 tion1 %7B%0A
+        /**This is a brute force but accepted solution.%0A         * More optimal solution:%0A         *  use a map to store only non-zero values and use the smaller vector to do multiplication to reduce space and save time.*/%0A
         

refactor 1570