Cody

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

Solution 3456623

Submitted on 28 Oct 2020
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   Fail
x = 1881;y_correct = 30; assert(isequal(yearraey(x),y_correct))

palin = '1,1,101,1,1,1,1,1,1,1,'

Error using bin2dec Binary text must consist of characters 0 and 1. Error in yearraey (line 10) if x > bin2dec(palin) Error in Test1 (line 2) assert(isequal(yearraey(x),y_correct))

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

palin = '1,1,101,1,1,1,1,1,1,1,'

Error using bin2dec Binary text must consist of characters 0 and 1. Error in yearraey (line 10) if x > bin2dec(palin) Error in Test2 (line 2) assert(isequal(yearraey(x),y_correct))

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

palin = '1,1,101,1,1,1,1,1,1,1,'

Error using bin2dec Binary text must consist of characters 0 and 1. Error in yearraey (line 10) if x > bin2dec(palin) Error in Test3 (line 2) assert(isequal(yearraey(x),y_correct))

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

Error using bin2dec Binary text must consist of characters 0 and 1. Error in yearraey (line 15) y = bin2dec(palin)-x; Error in Test4 (line 2) assert(isequal(yearraey(x),y_correct))

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

palin = '1,1,1,0,1,1,1,1,1,1,1,1,1,'

Error using bin2dec Binary text must consist of characters 0 and 1. Error in yearraey (line 10) if x > bin2dec(palin) Error in Test5 (line 2) assert(isequal(yearraey(x),y_correct))

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

Error using bin2dec Binary text must consist of characters 0 and 1. Error in yearraey (line 15) y = bin2dec(palin)-x; Error in Test6 (line 2) assert(isequal(yearraey(x),y_correct))

7   Fail
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))

palin = '101,1,'

Error using bin2dec Binary text must consist of characters 0 and 1. Error in yearraey (line 10) if x > bin2dec(palin) Error in Test7 (line 4) k(n)=yearraey(y);

Community Treasure Hunt

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

Start Hunting!