Cody

Problem 42298. Repeat The Components of Matrix

Solution 875521

Submitted on 16 Apr 2016 by Rathin Joshi
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 2 3 4 5 6 7]; y_correct = [1 1 2 2 3 3 4 4 5 5 6 6 7 7]; assert(isequal(RepeatComponenets(x),y_correct))

y = 0 1 y = 1 1 y = 1 1 0 2 y = 1 1 2 2 y = 1 1 2 2 0 3 y = 1 1 2 2 3 3 y = 1 1 2 2 3 3 0 4 y = 1 1 2 2 3 3 4 4 y = 1 1 2 2 3 3 4 4 0 5 y = 1 1 2 2 3 3 4 4 5 5 y = 1 1 2 2 3 3 4 4 5 5 0 6 y = 1 1 2 2 3 3 4 4 5 5 6 6 y = 1 1 2 2 3 3 4 4 5 5 6 6 0 7 y = 1 1 2 2 3 3 4 4 5 5 6 6 7 7

2   Pass
x = [0 1 5 6 -7 0 9 6]; y_correct = [0 0 1 1 5 5 6 6 -7 -7 0 0 9 9 6 6]; assert(isequal(RepeatComponenets(x),y_correct))

y = 0 0 y = 0 0 y = 0 0 0 1 y = 0 0 1 1 y = 0 0 1 1 0 5 y = 0 0 1 1 5 5 y = 0 0 1 1 5 5 0 6 y = 0 0 1 1 5 5 6 6 y = 0 0 1 1 5 5 6 6 0 -7 y = 0 0 1 1 5 5 6 6 -7 -7 y = 0 0 1 1 5 5 6 6 -7 -7 0 0 y = 0 0 1 1 5 5 6 6 -7 -7 0 0 y = 0 0 1 1 5 5 6 6 -7 -7 0 0 0 9 y = 0 0 1 1 5 5 6 6 -7 -7 0 0 9 9 y = 0 0 1 1 5 5 6 6 -7 -7 0 0 9 9 0 6 y = 0 0 1 1 5 5 6 6 -7 -7 0 0 9 9 6 6