Cody

# Problem 2408. Find the biggest digit in a matrix

Solution 468451

Submitted on 9 Jul 2014 by James
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))

na = 1 2 4 7 8 6 1 0 6 5 9 2 na = 1 2 4 7 8 6 1 0 6 5 9 2 na = 1 2 4 7 8 6 1 0 6 5 9 2 ans = 9

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

na = -16 1 1 -16 1 0 -16 -16 1 -16 -16 0 -16 -16 2 30 49 30 na = 0 1 1 0 1 0 0 0 1 0 0 0 0 0 2 30 49 30 na = 0 1 1 0 1 0 0 0 1 0 0 0 0 0 2 0 0 0 ans = 2

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

na = -16 1 1 -16 1 0 -16 -16 1 -16 -16 0 -16 2 2 -16 2 0 25 62 54 -16 1 2 na = 0 1 1 0 1 0 0 0 1 0 0 0 0 2 2 0 2 0 25 62 54 0 1 2 na = 0 1 1 0 1 0 0 0 1 0 0 0 0 2 2 0 2 0 0 0 0 0 1 2 ans = 2

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

na = -16 -16 -16 -16 -16 -16 1 4 5 -16 -16 -16 -16 -16 8 5 8 6 -16 1 2 4 8 7 8 1 1 -16 -16 -16 4 5 6 7 8 8 -16 -16 -16 -16 -16 -16 -16 -16 0 1 4 7 8 5 2 2 1 4 na = 0 0 0 0 0 0 1 4 5 0 0 0 0 0 8 5 8 6 0 1 2 4 8 7 8 1 1 0 0 0 4 5 6 7 8 8 0 0 0 0 0 0 0 0 0 1 4 7 8 5 2 2 1 4 na = 0 0 0 0 0 0 1 4 5 0 0 0 0 0 8 5 8 6 0 1 2 4 8 7 8 1 1 0 0 0 4 5 6 7 8 8 0 0 0 0 0 0 0 0 0 1 4 7 8 5 2 2 1 4 ans = 8

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

na = 1 -16 -16 1 -16 -16 1 -16 -16 1 -16 -16 1 1 -16 -16 1 -16 -16 1 -16 -16 1 -16 -16 1 1 -16 -16 1 -16 -16 1 -16 -16 1 -16 -16 1 1 -16 -16 1 -16 -16 1 -16 -16 1 -16 -16 1 1 -16 -16 1 -16 -16 1 -16 -16 1 -16 -16 1 na = 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 na = 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 ans = 1

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

na = Columns 1 through 16 4 7 -16 -16 5 8 -16 -16 6 9 -16 -16 8 0 -16 -16 5 7 -16 -16 6 8 -16 -16 7 9 -16 -16 -16 9 -16 -16 6 7 -16 -16 7 8 -16 -16 -16 8 -16 -16 1 0 -16 -16 7 7 -16 -16 -16 7 -16 -16 1 8 -16 -16 2 0 -16 -16 -16 6 -16 -16 1 7 -16 -16 1 9 -16 -16 3 0 -16 -16 1 6 -16 -16 2 7 -16 -16 2 9 -16 -16 4 0 -16 -16 2 6 -16 -16 2 8 -16 -16 3 9 -16 -16 5 0 -16 -16 3 6 -16 -16 3 8 -16 -16 4 9 -16 -16 6 0 -16 -16 3 7 -16 -16 4 8 -16 -16 5 9 -16 -16 7 0 -16 -16 Columns 17 through 32 -16 1 -16 -16 1 2 -16 -16 2 3 -16 -16 3 4 -16 -16 1 1 -16 -16 2 2 -16 -16 3 3 -16 -16 4 4 -16 -16 2 1 -16 -16 3 2 -16 -16 4 3 -16 -16 5 4 -16 -16 3 1 -16 -16 4 2 -16 -16 5 3 -16 -16 5 5 -16 -16 4 1 -16 -16 5 2 -16 -16 6 3 -16 -16 6 5 -16 -16 5 1 -16 -16 6 2 -16 -16 6 4 -16 -16 7 5 -16 -16 6 1 -16 -16 7 2 -16 -16 7 4 -16 -16 -16 4 -16 -16 7 1 -16 -16 7 3 -16 -16 -16 3 -16 -16 1 4 -16 -16 8 1 -16 -16 -16 2 -16 -16 1 3 -16 -16 2 4 -16 -16 Columns 33 through 34 4 5 4 6 5 6 6 6 7 6 -16 5 1 5 2 5 3 5 na = Columns 1 through 16 4 7 0 0 5 8 0 0 6 9 0 0 8 0 0 0 5 7 0 0 6 8 0 0 7 9 0 0 0 9 0 0 6 7 0 0 7 8 0 0 0 8 0 0 1 0 0 0 7 7 0 0 0 7 0 0 1 8 0 0 2 0 0 0 0 6 0 0 1 7 0 0 1 9 0 0 3 0 0 0 1 6 0 0 2 7 0 0 2 9 0 0 4 0 0 0 2 6 0 0 2 8 0 0 3 9 0 0 5 0 0 0 3 6 0 0 3 8 0 0 4 9 0 0 6 0 0 0 3 7 0 0 4 8 0 0 5 9 0 0 7 0 0 0 Columns 17 through 32 0 1 0 0 1 2 0 0 2 3 0 0 3 4 0 0 1 1 0 0 2 2 0 0 3 3 0 0 4 4 0 0 2 1 0 0 3 2 0 0 4 3 0 0 5 4 0 0 3 1 0 0 4 2 0 0 5 3 0 0 5 5 0 0 4 1 0 0 5 2 0 0 6 3 0 0 6 5 0 0 5 1 0 0 6 2 0 0 6 4 0 0 7 5 0 0 6 1 0 0 7 2 0 0 7 4 0 0 0 4 0 0 7 1 0 0 7 3 0 0 0 3 0 0 1 4 0 0 8 1 0 0 0 2 0 0 1 3 0 0 2 4 0 0 Columns 33 through 34 4 5 4 6 5 6 6 6 7 6 0 5 1 5 2 5 3 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