 Determinant of a Matrix
Submissions: 166   Accuracy: 31.34%   Difficulty: Basic   Marks: 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.

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.