Cody

Solution 1705007

Submitted on 9 Jan 2019
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
filetext = fileread('dec_2_binvec.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp() and its family are forbidden') assert(isempty(strfind(filetext, 'dec2binvec')),'dec2binvec() forbidden') assert(isempty(strfind(filetext, 'num2str')),'num2str() forbidden') assert(isempty(strfind(filetext, 'regexprep')),'regexprep() forbidden') assert(isempty(strfind(filetext, 'for')),'for() forbidden') assert(isempty(strfind(filetext, 'while')),'while() forbidden') assert(isempty(strfind(filetext, 'if')),'if() forbidden') assert(isempty(strfind(filetext, 'mrdivide')),'mrdivide() forbidden') assert(isempty(strfind(filetext, 'mldivide')),'mldivide() forbidden') assert(isempty(strfind(filetext, '\')),'\ forbidden') assert(isempty(strfind(filetext, '/')),'/ forbidden') assert(isempty(strfind(filetext, '^')),'^ forbidden') assert(isempty(strfind(filetext, 'rem')),'rem() forbidden') assert(isempty(strfind(filetext, 'mod')),'mod() forbidden') assert(isempty(strfind(filetext, 'java')),'java forbidden')

for() forbidden

2   Pass
x = 1; assert(isequal(dec_2_binvec(x),1))

y = 1

3   Pass
x = 5; assert(isequal(dec_2_binvec(x),[1 0 1]))

y = 1 y = 1 0 y = 1 0 1

4   Fail
x = 1000; assert(isequal(dec_2_binvec(x),[0 0 0 1 0 1 1 1 1 1]))

y = 1 y = 1 1 y = 1 1 1 y = 1 1 1 1 y = 1 1 1 1 1 y = 1 1 1 1 1 0 y = 1 1 1 1 1 0 1 y = 1 1 1 1 1 0 1 0 y = 1 1 1 1 1 0 1 0 0 y = 1 1 1 1 1 0 1 0 0 0

Assertion failed.

5   Fail
x = 2700; assert(isequal(dec_2_binvec(x),[0 0 1 1 0 0 0 1 0 1 0 1]))

y = 1 y = 1 0 y = 1 0 1 y = 1 0 1 0 y = 1 0 1 0 1 y = 1 0 1 0 1 0 y = 1 0 1 0 1 0 0 y = 1 0 1 0 1 0 0 0 y = 1 0 1 0 1 0 0 0 1 y = 1 0 1 0 1 0 0 0 1 1 y = 1 0 1 0 1 0 0 0 1 1 0 y = 1 0 1 0 1 0 0 0 1 1 0 0

Assertion failed.

6   Fail
x = 8210; assert(isequal(dec_2_binvec(x),[0 1 0 0 1 0 0 0 0 0 0 0 0 1]))

y = 1 y = 1 0 y = 1 0 0 y = 1 0 0 0 y = 1 0 0 0 0 y = 1 0 0 0 0 0 y = 1 0 0 0 0 0 0 y = 1 0 0 0 0 0 0 0 y = 1 0 0 0 0 0 0 0 0 y = 1 0 0 0 0 0 0 0 0 1 y = 1 0 0 0 0 0 0 0 0 1 0 y = 1 0 0 0 0 0 0 0 0 1 0 0 y = 1 0 0 0 0 0 0 0 0 1 0 0 1 y = 1 0 0 0 0 0 0 0 0 1 0 0 1 0

Assertion failed.

7   Fail
x = 44580; assert(isequal(dec_2_binvec(x),[0 0 1 0 0 1 0 0 0 1 1 1 0 1 0 1]))

y = 1 y = 1 0 y = 1 0 1 y = 1 0 1 0 y = 1 0 1 0 1 y = 1 0 1 0 1 1 y = 1 0 1 0 1 1 1 y = 1 0 1 0 1 1 1 0 y = 1 0 1 0 1 1 1 0 0 y = 1 0 1 0 1 1 1 0 0 0 y = 1 0 1 0 1 1 1 0 0 0 1 y = 1 0 1 0 1 1 1 0 0 0 1 0 y = 1 0 1 0 1 1 1 0 0 0 1 0 0 y = 1 0 1 0 1 1 1 0 0 0 1 0 0 1 y = 1 0 1 0 1 1 1 0 0 0 1 0 0 1 0 y = 1 0 1 0 1 1 1 0 0 0 1 0 0 1 0 0

Assertion failed.

Suggested Problems

More from this Author14