(a) The maximum number of linearly independent column vectors in the matrix or (b) The maximum number of linearly independent row vectors in the matrix. Both definitions are equivalent.
In the theory of vector spaces, a set of vectors is said to be linearly dependent if there is a nontrivial linear combination of the vectors that equals the zero vector. If no such linear combination exists, then the vectors are said to be linearly independent.
The first line contains a single integer ‘T’ denoting the number of test cases. The first line of every test case contains two space-separated integers, ‘N’ and ‘M’, denoting the number of rows and the number of columns respectively. Then each of the next ‘N’ rows contains ‘M’ elements.
For each test case, return the rank of the matrix.
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10 1 <= N , M <= 500 -10^4 <= Arr[i][j] <= 10^4 Where ‘ARR[i][j]’ denotes the matrix element at the jth column in the ith row of ‘ARR’ Time Limit: 1 sec
Ninja and the experiment
Search In A Sorted 2D Matrix