Given some multidimensional matrix A. Get a matrix of the same size as A where all elements are replaced by their index along the kth dimension
Example
Input
A = ans(:,:,1) =
1 3 6 2
ans(:,:,2) =
6 9 7 6
Output:
f(A,1) = ans(:,:,1) =
1 1 2 2
ans(:,:,2) =
1 1 2 2
f(A,2) = ans(:,:,1) =
1 2 1 2
ans(:,:,2) =
1 2 1 2
f(A, 3) =
ans(:,:,1) =
1 1 1 1
ans(:,:,2) =
2 2 2 2
Deterministic solution would fail if you add at least one more test case for the 2-D or 4-D arrays.
find the maximum element of the matrix
254 Solvers
263 Solvers
197 Solvers
Determine point is located in a circle or not
47 Solvers
Find the sum of the negative elements under the main diagonal.
36 Solvers