Cody

Problem 1683. Create different color vectors.

Solution 2494811

Submitted on 8 Jun 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 = 3; y = get_colorVs(x); c0 = 0; c1 = 0; cw = 0; cs = 0; cd = 0; for i = 1:3 cs = cs + (length(y{i})~=3); c0 = c0 + sum(y{i}<0); c1 = c1 + sum(y{i}>1); cw = cw + (sum(y{i}) > 2.5); end for i = 1:x-1 for j = i+1:x cd = cd + (sum(y{i}==y{j}) == 3); end end assert(isequal(cs+c0+c1+cw+cd,0))

0 2147483648 4294967295

Assertion failed.

2   Fail
x = 12; y = get_colorVs(x); c0 = 0; c1 = 0; cw = 0; cs = 0; cd = 0; for i = 1:3 cs = cs + (length(y{i})~=3); c0 = c0 + sum(y{i}<0); c1 = c1 + sum(y{i}>1); cw = cw + (sum(y{i}) > 2.5); end for i = 1:x-1 for j = i+1:x cd = cd + (sum(y{i}==y{j}) == 3); end end assert(isequal(cs+c0+c1+cw+cd,0))

0 390451572 780903145 1171354717 1561806289 1952257861 2342709434 2733161006 3123612578 3514064150 3904515723 4294967295

Assertion failed.

Suggested Problems

More from this Author1

Community Treasure Hunt

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

Start Hunting!