Cody

Solution 371626

Submitted on 17 Dec 2013 by Paul Berglund
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))
4   Pass
%% x = randi(2,10,10)-1; y = only_once(x); assert(all(sum(y,1)==any(y,1)))
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)))