Cody

Solution 1196986

Submitted on 24 May 2017 by Karen Yee
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
str = 'b';n=5 y_correct = 'bbbbb'; assert(isequal(duplicate_char(str,n),y_correct))

n = 5 i = 1 k = 1 2 3 4 5 d = 'b' d = 'b' k = 98 2 3 4 5 i = 2 d = 'b' k = 98 98 3 4 5 i = 3 d = 'b' k = 98 98 98 4 5 i = 4 d = 'b' k = 98 98 98 98 5 i = 5 d = 'b' k = 98 98 98 98 98 i = 6 y = 'bbbbb'

2   Pass
str = 's';n=1 y_correct = 's'; assert(isequal(duplicate_char(str,n),y_correct))

n = 1 i = 1 k = 1 d = 's' d = 's' k = 115 i = 2 y = 's'

3   Pass
str = 'b';n=10 y_correct = 'bbbbbbbbbb'; assert(isequal(duplicate_char(str,n),y_correct))

n = 10 i = 1 k = 1 2 3 4 5 6 7 8 9 10 d = 'b' d = 'b' k = 98 2 3 4 5 6 7 8 9 10 i = 2 d = 'b' k = 98 98 3 4 5 6 7 8 9 10 i = 3 d = 'b' k = 98 98 98 4 5 6 7 8 9 10 i = 4 d = 'b' k = 98 98 98 98 5 6 7 8 9 10 i = 5 d = 'b' k = 98 98 98 98 98 6 7 8 9 10 i = 6 d = 'b' k = 98 98 98 98 98 98 7 8 9 10 i = 7 d = 'b' k = 98 98 98 98 98 98 98 8 9 10 i = 8 d = 'b' k = 98 98 98 98 98 98 98 98 9 10 i = 9 d = 'b' k = 98 98 98 98 98 98 98 98 98 10 i = 10 d = 'b' k = 98 98 98 98 98 98 98 98 98 98 i = 11 y = 'bbbbbbbbbb'

4   Pass
str = 'b';n=0 y_correct = ''; assert(isequal(duplicate_char(str,n),y_correct))

n = 0 i = 1 k = 1×0 empty double row vector d = 'b' y = 0×0 empty char array

5   Pass
str = '?';n=2 y_correct = '??'; assert(isequal(duplicate_char(str,n),y_correct))

n = 2 i = 1 k = 1 2 d = '?' d = '?' k = 63 2 i = 2 d = '?' k = 63 63 i = 3 y = '??'