Vector Dot Product

EasyMachine LearningMath

Description

Given two equal-length vectors a and b, return their dot product (sum of element-wise products).

Examples

Input:a = [1,2,3], b = [4,5,6]
Output:32
Explanation:

Summing the element-wise products gives 32.

Input:a = [1,0], b = [0,1]
Output:0
Explanation:

Summing the element-wise products gives 0.

Input:a = [2,2], b = [3,3]
Output:12
Explanation:

Summing the element-wise products gives 12.

Constraints

  • 1 ≤ a.length ≤ 10⁴

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.