Cody

Solution 2654222

Submitted on 5 Jul 2020 by Nikolaos Nikolaou
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
tic

2   Pass
x = 5; y_correct = 5; assert(isequal(hamming1(x),y_correct))

s = 2 y = 5

3   Pass
x = 100; y_correct = 34; assert(isequal(hamming1(x),y_correct))

s = 2 y = 34

4   Pass
x = 123456; y_correct = 327; assert(isequal(hamming1(x),y_correct))

s = 2 y = 327

5   Pass
x = 10^13; y_correct = 4301; assert(isequal(hamming1(x),y_correct))

s = 2 y = 4301

6   Pass
x=1:20; y=arrayfun(@(z) hamming1(z),2.^x); y_correct=[2 4 7 12 19 27 38 52 68 87 110 137 167 201 240 284 332 386 446 511]; assert(isequal(y,y_correct)); tval=1000*toc feval( @assignin,'caller','score',floor(min(5000,tval )) );

s = 2 y = 2 s = 2 y = 4 s = 2 y = 7 s = 2 y = 12 s = 2 y = 19 s = 2 y = 27 s = 2 y = 38 s = 2 y = 52 s = 2 y = 68 s = 2 y = 87 s = 2 y = 110 s = 2 y = 137 s = 2 y = 167 s = 2 y = 201 s = 2 y = 240 s = 2 y = 284 s = 2 y = 332 s = 2 y = 386 s = 2 y = 446 s = 2 y = 511 tval = 369.9900