Cody

Solution 531659

Submitted on 21 Nov 2014 by Pritesh Shah
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 ans = 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))

x = 11 10 1 0 2 0 x = 11 10 1 0 2 0 ans = 1 1 1 0 -16 1 -16 0 -16 2 -16 0 ans = 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 Inf 12 x = 11 10 1 0 22 20 0 12 ans = 1 1 1 0 -16 1 -16 0 2 2 2 0 -16 0 1 2 ans = 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 ans = -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 ans = 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 ans = 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 ans = 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 ans = 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 ans = 9

Suggested Problems

More from this Author58