Cody

Problem 2408. Find the biggest digit in a matrix

Solution 585049

Submitted on 19 Feb 2015 by Abdullah Caliskan
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 = [12; 47; 86; 10; 65; 92]; y_correct = 9; assert(isequal(biggest_digit(x),y_correct))

x = 12 47 86 10 65 92 x = 12 47 86 10 65 92 y = 9

2   Pass
%% x = [11; 10; 1; 0; 2; NaN]; y_correct = 2; assert(isequal(biggest_digit(x),y_correct))

x = 11 10 1 0 2 NaN x = 11 10 1 0 2 0 y = 2

3   Pass
%% x = [11; 10; 1; 0; 22; 20; Inf; 12]; y_correct = 2; assert(isequal(biggest_digit(x),y_correct))

x = 11 10 1 0 22 20 0 12 x = 11 10 1 0 22 20 0 12 y = 2

4   Pass
%% x = [145; 8586; 12487811; 456788; 0; 147852214]; y_correct = 8; assert(isequal(biggest_digit(x),y_correct))

x = 145 8586 12487811 456788 0 147852214 x = 145 8586 12487811 456788 0 147852214 y = 8

5   Pass
%% x = ones(5,5); y_correct = 1; assert(isequal(biggest_digit(x),y_correct))

x = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 x = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 y = 1

6   Pass
%% x = magic(9); y_correct = 9; assert(isequal(biggest_digit(x),y_correct))

x = 47 58 69 80 1 12 23 34 45 57 68 79 9 11 22 33 44 46 67 78 8 10 21 32 43 54 56 77 7 18 20 31 42 53 55 66 6 17 19 30 41 52 63 65 76 16 27 29 40 51 62 64 75 5 26 28 39 50 61 72 74 4 15 36 38 49 60 71 73 3 14 25 37 48 59 70 81 2 13 24 35 x = 47 58 69 80 1 12 23 34 45 57 68 79 9 11 22 33 44 46 67 78 8 10 21 32 43 54 56 77 7 18 20 31 42 53 55 66 6 17 19 30 41 52 63 65 76 16 27 29 40 51 62 64 75 5 26 28 39 50 61 72 74 4 15 36 38 49 60 71 73 3 14 25 37 48 59 70 81 2 13 24 35 y = 9