Cody

Problem 2869. There are 10 types of people in the world

Solution 2174857

Submitted on 25 Mar 2020 by Ahmed Abdelbasit
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 = 1881;y_correct = 30; assert(isequal(yearraey(x),y_correct))

temp = '11101011001'

2   Pass
x = 2014;y_correct = 1; assert(isequal(yearraey(x),y_correct))

temp = '11111011110'

3   Pass
x = 2015;y_correct = 0; assert(isequal(yearraey(x),y_correct))

temp = '11111011111'

4   Pass
x = 606;y_correct = 27; assert(isequal(yearraey(x),y_correct))

temp = '1001011110'

5   Pass
x = 6006;y_correct = 71; assert(isequal(yearraey(x),y_correct))

temp = '1011101110110'

6   Pass
x = 60006;y_correct = 369; assert(isequal(yearraey(x),y_correct))

temp = '1110101001100110'

7   Pass
k=zeros(1,15); for n=1:15 y=2^n+2; k(n)=yearraey(y); end y_correct=[1 1 5 3 11 7 23 15 47 31 95 63 191 127 383]; assert(isequal(k,y_correct))

temp = '100' temp = '110' temp = '1010' temp = '10010' temp = '100010' temp = '1000010' temp = '10000010' temp = '100000010' temp = '1000000010' temp = '10000000010' temp = '100000000010' temp = '1000000000010' temp = '10000000000010' temp = '100000000000010' temp = '1000000000000010'

Suggested Problems

More from this Author80

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!