Cody

Solution 2097404

Submitted on 18 Jan 2020 by Asif Newaz
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 = 1; y_correct = 1; y = only_once(x); assert(isequal(y,y_correct))

2   Pass
x = [1 0 0 1]; y_correct = [1 0 0 1]; y = only_once(x); assert(isequal(y,y_correct))

3   Pass
x = [0 0 1 1 0;0 1 1 0 0;0 0 0 0 1]; y_correct = [0 0 1 1 0;0 1 0 0 0;0 0 0 0 1]; y = only_once(x); assert(isequal(y,y_correct))

b = 1 2 c = 2

4   Pass
x = randi(2,10,10)-1; y = only_once(x); assert(all(sum(y,1)==any(y,1)))

b = 3 5 6 9 c = 5 6 9 b = 7 9 10 c = 9 10 b = 1 2 5 7 8 9 10 c = 2 5 7 8 9 10 b = 1 8 9 10 c = 8 9 10 b = 1 2 3 4 5 8 10 c = 2 3 4 5 8 10 b = 1 3 5 6 8 10 c = 3 5 6 8 10 b = 1 3 7 10 c = 3 7 10 b = 4 5 7 9 c = 5 7 9 b = 1 3 4 5 9 10 c = 3 4 5 9 10 b = 2 3 4 7 9 10 c = 3 4 7 9 10

5   Pass
x = randi(2,1,100)-1; y = only_once(x); assert(all(sum(y,1)==any(y,1)))

6   Pass
x = randi(2,10,1)-1; y = only_once(x); assert(all(sum(y,1)==any(y,1)))

b = 1 2 4 6 7 8 9 10 c = 2 4 6 7 8 9 10