Skip to content
DeepForgeby svx
All problems
MediumLinear Algebrala-029

Matrix Minor

Problem

Return the minor of matrix A obtained by deleting row i and column j.

A is square; the result is (n-1) x (n-1).

Hint

Keep rows except i and columns except j.

Test cases

case 1
in: [[[1,2,3],[4,5,6],[7,8,9]],0,0]
expected: [[5,6],[8,9]]
case 2
in: [[[1,2,3],[4,5,6],[7,8,9]],1,2]
expected: [[1,2],[7,8]]
case 3
in: [[[1,2,3],[4,5,6],[7,8,9]],2,1]
expected: [[1,3],[4,6]]
case 4
in: [[[5,6],[7,8]],0,1]
expected: [[7]]
Starter codePython
def matrix_minor(A, i, j):
    # Your code here
    pass

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