All problems
Analogy Vector Arithmetic
Problem
Word analogies use vector offsets: the analogy A is to B as C is to X is solved by X = A - B + C.
Given vectors a, b, and c, return the result vector.
Hint
Add the offset from B to A onto C.
Test cases
case 1
in: [[1,2],[0,1],[1,0]]
expected: [2,1]
case 2
in: [[1,1,1],[0,0,0],[2,2,2]]
expected: [3,3,3]
case 3
in: [[0,0],[1,1],[1,1]]
expected: [0,0]
Starter codePython
def analogy_vector_arithmetic(a, b, c):
# Your code here
pass3 test cases · run your code against them in the editor