Skip to content
DeepForgeby svx
All problems
EasyLinear Algebrala-196

Vandermonde Determinant

Problem

Compute the determinant of the Vandermonde matrix built from the values x without forming the matrix:

det = product over i < j of (x[j] - x[i])

Repeated values make the determinant 0.

Hint

Each pair of values contributes a difference factor.

Test cases

case 1
in: [[1,2,3]]
expected: 2
case 2
in: [[0,1]]
expected: 1
case 3
in: [[2,2,3]]
expected: 0
case 4
in: [[1,2,3,4]]
expected: 12
Starter codePython
def vandermonde_det(x):
    # Your code here
    pass

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