Cody

Solution 453245

Submitted on 10 Jun 2014 by rifat
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 = '0'; y_correct = 0; assert(isequal(lengthOnes(x),y_correct))

i = 0

2   Pass
%% x = '1'; y_correct = 1; assert(isequal(lengthOnes(x),y_correct))

3   Pass
%% x = '01'; y_correct = 1; assert(isequal(lengthOnes(x),y_correct))

i = 1

4   Pass
%% x = '10'; y_correct = 1; assert(isequal(lengthOnes(x),y_correct))

i = 1

5   Pass
%% x = '00'; y_correct = 0; assert(isequal(lengthOnes(x),y_correct))

i = 1 i = 0

6   Pass
%% x = '11'; y_correct = 2; assert(isequal(lengthOnes(x),y_correct))

7   Pass
%% x = '1111111111'; y_correct = 10; assert(isequal(lengthOnes(x),y_correct))

8   Pass
%% x = '100101011111010011111'; y_correct = 5; assert(isequal(lengthOnes(x),y_correct))

i = 20 i = 19 i = 18 i = 17 i = 16 i = 15 i = 14 i = 13 i = 12 i = 11 i = 10 i = 9 i = 8 i = 7 i = 6 i = 5

9   Pass
%% x = '01010101010101010101010101'; y_correct = 1; assert(isequal(lengthOnes(x),y_correct))

i = 25 i = 24 i = 23 i = 22 i = 21 i = 20 i = 19 i = 18 i = 17 i = 16 i = 15 i = 14 i = 13 i = 12 i = 11 i = 10 i = 9 i = 8 i = 7 i = 6 i = 5 i = 4 i = 3 i = 2 i = 1

10   Pass
%% x = '0101010111000101110001011100010100001110110100000000110001001000001110001000111010101001101100001111'; y_correct = 4; assert(isequal(lengthOnes(x),y_correct))

i = 99 i = 98 i = 97 i = 96 i = 95 i = 94 i = 93 i = 92 i = 91 i = 90 i = 89 i = 88 i = 87 i = 86 i = 85 i = 84 i = 83 i = 82 i = 81 i = 80 i = 79 i = 78 i = 77 i = 76 i = 75 i = 74 i = 73 i = 72 i = 71 i = 70 i = 69 i = 68 i = 67 i = 66 i = 65 i = 64 i = 63 i = 62 i = 61 i = 60 i = 59 i = 58 i = 57 i = 56 i = 55 i = 54 i = 53 i = 52 i = 51 i = 50 i = 49 i = 48 i = 47 i = 46 i = 45 i = 44 i = 43 i = 42 i = 41 i = 40 i = 39 i = 38 i = 37 i = 36 i = 35 i = 34 i = 33 i = 32 i = 31 i = 30 i = 29 i = 28 i = 27 i = 26 i = 25 i = 24 i = 23 i = 22 i = 21 i = 20 i = 19 i = 18 i = 17 i = 16 i = 15 i = 14 i = 13 i = 12 i = 11 i = 10 i = 9 i = 8 i = 7 i = 6 i = 5 i = 4