Cody

# Problem 1461. Duplicate a character

Solution 1766168

Submitted on 29 Mar 2019 by Abdelfatah Teamah
• Size: 8
• This is the leading solution.
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 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In duplicate_char (line 2) In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

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

n = 1 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In duplicate_char (line 2) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

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

n = 10 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In duplicate_char (line 2) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

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

n = 0 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In duplicate_char (line 2) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]

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

n = 2 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In duplicate_char (line 2) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]