All problems
Determinant of Scaled Matrix
Problem
Compute the determinant of c*A for a square matrix A of size 1, 2, or 3.
Scaling an n x n matrix by c multiplies its determinant by c^n. Return the determinant as a number.
Hint
det(c*A) = c^n * det(A) for an n x n matrix.
Test cases
case 1
in: [[[1,2],[3,4]],2]
expected: -8
case 2
in: [[[1,2],[3,4]],0]
expected: 0
case 3
in: [[[2,0,1],[0,3,0],[1,0,2]],-1]
expected: -9
case 4
in: [[[3]],5]
expected: 15
case 5
in: [[[1,2,3],[4,5,6],[7,8,10]],1]
expected: -3
Starter codePython
def determinant_scaled_matrix(A, c):
# Your code here
pass5 test cases · run your code against them in the editor