Cody

Solution 197086

Submitted on 26 Jan 2013 by Richard Zapor
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
%% n = 0; k_correct = 1; assert(isequal(num_ones(n),k_correct))

1

2   Pass
%% n = 1; k_correct = 2; assert(isequal(num_ones(n),k_correct))

1010

3   Pass
%% n = 2; k_correct = 3; assert(isequal(num_ones(n),k_correct))

1100100

4   Pass
%% n = 5; k_correct = 6; assert(isequal(num_ones(n),k_correct))

11000011010100000

5   Pass
%% n = 10; k_correct = 11; assert(isequal(num_ones(n),k_correct))

1001010100000010111110010000000000

6   Pass
%% n = 15; k_correct = 20; assert(isequal(num_ones(n),k_correct))

11100011010111111010100100110001101000000000000000

7   Pass
%% n = 22; k_correct = 25; assert(isequal(num_ones(n),k_correct))

10000111100001100111100000110010011011101010110010010000000000000000000000

8   Pass
%% n = 23; k_correct = 27; assert(isequal(num_ones(n),k_correct))

10101001011010000001011000111111000010100101011110110100000000000000000000000

9   Pass
%% n = 45; k_correct = 53; assert(isequal(num_ones(n),k_correct))

101100110101110110111111100000100001101011100100111100111000101111011101101000101000000000101100100010101000000000000000000000000000000000000000000000

10   Pass
%% n = 100; k_correct = 105; assert(isequal(num_ones(n),k_correct))

100100100100110101101001001011001010011000011011111001110101100001011001001111000010011000100110011100000101111110011100010101100111001000000100011100010000100011010011111001010101010110010010000110000100010101000001011101000111100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000