Compute the cosine of the angle between two equal-length vectors.
Implement solve(a, b).
Returns. Return a float in [−1,1]. If either vector is all zeros the angle is undefined and the function returns 0.0.
Example 1
Input:
solve([1.0, 0.0], [1.0, 1.0])
Output:
0.707107
Example 2
Input:
solve([1.0, 2.0], [-1.0, -2.0])
Output:
-1.0
No results yet
Run your code to check it against the examples, or submit to run every test.