Cody

Problem 1273. Max index of 3D array

Solution 1719139

Submitted on 1 Feb 2019 by Nikolaos Nikolaou
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = zeros(10,10,10); x(5,5,5) = 10; y_correct = [5,5,5]; assert(isequal(Index_Max3d(x),y_correct))

t1 = 10 t2 = 445 I = 5 J = 5 K = 5 y = 5 5 5

2   Pass
x = randn(10,10,10); x(7,5,8) = 11; y_correct = [7,5,8]; assert(isequal(Index_Max3d(x),y_correct))

t1 = 11 t2 = 747 I = 7 J = 5 K = 8 y = 7 5 8

3   Pass
x = randn(10,10,100); x(10,5,8) = 99; y_correct = [10,5,8]; assert(isequal(Index_Max3d(x),y_correct))

t1 = 99 t2 = 750 I = 10 J = 5 K = 8 y = 10 5 8

4   Pass
x = randn(10,10,10); x(1,3,7) = 42; y_correct = [1,3,7]; assert(isequal(Index_Max3d(x),y_correct))

t1 = 42 t2 = 621 I = 1 J = 3 K = 7 y = 1 3 7

5   Pass
x = randn(10,10,100); x(4,4,7) = 123456789; y_correct = [4,4,7]; assert(isequal(Index_Max3d(x),y_correct))

t1 = 123456789 t2 = 634 I = 4 J = 4 K = 7 y = 4 4 7

6   Pass
x = randn(10,10,10); x(1,1,9) = 10701; y_correct = [1,1,9]; assert(isequal(Index_Max3d(x),y_correct))

t1 = 10701 t2 = 801 I = 1 J = 1 K = 9 y = 1 1 9

7   Pass
x = randn(10,10,100); x(1,7,3) = 10701; y_correct = [1,7,3]; assert(isequal(Index_Max3d(x),y_correct))

t1 = 10701 t2 = 261 I = 1 J = 7 K = 3 y = 1 7 3