← Problems2. Dot Product
EasyVectorsLinear AlgebraNumPy
Given two vectors a and b of equal length, return their dot product.
The dot product is defined as:
a⋅b=∑i=1naibi
Where n is the length of each vector.
Example
a = [1, 2, 3]
b = [4, 5, 6]
Output: 32 # (1×4 + 2×5 + 3×6)
Constraints
- You may use NumPy or pure Python.
- Both inputs will always have the same length.