Skip to content
DeepForgeby svx
All problems

Goal-Conditioned Distance

Problem

Compute the Euclidean distance between a state and a goal vector. Return the square root of the sum of squared differences.

Hint

Goal-conditioned rewards are often the negative of this distance.

Test cases

case 1
in: [[0,0],[3,4]]
expected: 5
case 2
in: [[1,2],[1,2]]
expected: 0
case 3
in: [[-1,-1],[2,3]]
expected: 5
case 4
in: [[1,1,1],[1,1,1]]
expected: 0
Starter codePython
import math
def goal_conditioned_distance(state, goal):
    # Your code here
    pass

4 test cases · run your code against them in the editor