Cody

Solution 713866

Submitted on 12 Aug 2015 by Honglei Chen
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
%% filetext = fileread('regular.m'); assert(isempty(strfind(filetext, 'for'))) assert(isempty(strfind(filetext, 'while')))

2   Pass
%% A = 1; B = 1; assert(isequal(regular(A),B));

3   Pass
%% A = [2 6 5 3 5 6 3 7]; B = [1 2 3 1 3 2 2 3]; assert(isequal(regular(A),B));

4   Pass
%% A = [10 2 4 4 2 4 5 6 8 1 6 5 10 3 9 9 9 5 5 5 9 10 3 7 8]; B = [4 1 2 2 2 1 2 4 5 1 2 2 5 1 5 3 3 3 3 3 3 4 1 4 4]; assert(isequal(regular(A),B));

5   Pass
%% A = randi(100,80,100); B = zeros(size(A)); for iter = 1:size(A,2) [~, ~, B(:, iter)] = unique(A(:,iter)); end assert(isequal(regular(A),B));