Determinant of a Matrix
Basic Accuracy: 31.45% Submissions: 264 Points: 1

Given a square matrix mat of size N x N. The task is to find the determinant of this matrix.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer N denoting the size of the matrix. The next line contains the elements of the matrix in row-wise form.

Output:
Print the determinant of the matrix.

Constraints:
1 <= T <= 100
1 <= N <= 100
-100 <= mat[i][j] <= 100

Example:
Input:

2
4
1 0 2 -1 3 0 0 5 2 1 4 -3 1 0 5 0
3
1 2 3 4 5 6 7 10 9

Output:
30
12

Explanation:
Testcase 1:
Determinant of the given matrix is 30.

 

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.