Cody

# Problem 2408. Find the biggest digit in a matrix

Solution 2095761

Submitted on 17 Jan 2020 by Asif Newaz
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))

d = 0×1 empty double column vector e = 0×1 empty double column vector a = 6×2 char array '12' '47' '86' '10' '65' '92' b = 12×1 char array '1' '4' '8' '1' '6' '9' '2' '7' '6' '0' '5' '2' c = '9' y = 9

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

d = 6 e = 0×1 empty double column vector a = 5×2 char array '11' '10' ' 1' ' 0' ' 2' b = 10×1 char array '1' '1' ' ' ' ' ' ' '1' '0' '1' '0' '2' c = '2' y = 2

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

d = 0×1 empty double column vector e = 7 a = 7×2 char array '11' '10' ' 1' ' 0' '22' '20' '12' b = 14×1 char array '1' '1' ' ' ' ' '2' '2' '1' '1' '0' '1' '0' '2' '0' '2' c = '2' y = 2

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

d = 0×1 empty double column vector e = 0×1 empty double column vector a = 6×9 char array ' 145' ' 8586' ' 12487811' ' 456788' ' 0' '147852214' b = 54×1 char array ' ' ' ' ' ' ' ' ' ' '1' ' ' ' ' '1' ' ' ' ' '4' ' ' ' ' '2' ' ' ' ' '7' ' ' ' ' '4' '4' ' ' '8' ' ' ' ' '8' '5' ' ' '5' ' ' '8' '7' '6' ' ' '2' '1' '5' '8' '7' ' ' '2' '4' '8' '1' '8' ' ' '1' '5' '6' '1' '8' '0' '4' c = '8' y = 8

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

d = 0×1 empty double column vector e = 0×1 empty double column vector a = 5×13 char array '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' b = 65×1 char array '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' c = '1' y = 1

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

d = 0×1 empty double column vector e = 0×1 empty double column vector a = 9×34 char array '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' b = 306×1 char array '4' '5' '6' '7' ' ' '1' '2' '3' '3' '7' '7' '7' '7' '6' '6' '6' '6' '7' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '5' '6' '7' ' ' '1' '2' '2' '3' '4' '8' '8' '8' '7' '7' '7' '8' '8' '8' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '6' '7' ' ' '1' '1' '2' '3' '4' '5' '9' '9' '8' '8' '9' '9' '9' '9' '9' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '8' ' ' '1' '2' '3' '4' '5' '6' '7' '0' '9' '0' '0' '0' '0' '0' '0' '0' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '1' '2' '3' '4' '5' '6' '7' '8' '1' '1' '1' '1' '1' '1' '1' '1' '1' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '1' '2' '3' '4' '5' '6' '7' '7' ' ' '2' '2' '2' '2' '2' '2' '2' '3' '2' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '2' '3' '4' '5' '6' '6' '7' ' ' '1' '3' '3' '3' '3' '3' '4' '4' '3' '3' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '3' '4' '5' '5' '6' '7' ' ' '1' '2' '4' '4' '4' '5' '5' '5' '4' '4' '4' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' '4' '4' '5' '6' '7' ' ' '1' '2' '3' '5' '6' '6' '6' '6' '5' '5' '5' '5' c = '9' y = 9