Cody

# Problem 44313. "Cody" * 5 == "CodyCodyCodyCodyCody"

Solution 1584409

Submitted on 16 Jul 2018
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
assessFunctionAbsence({'regexp','regexpi','regexprep','str2num'},'FileName','mtimes.m')

2   Fail
assert(isequal("cody" * 5, "codycodycodycodycody"))

y = [] c = 5 d = "cody" y = "cody" y = 1×2 string array "cody" "cody" y = 1×3 string array "cody" "cody" "cody" y = 1×4 string array "cody" "cody" "cody" "cody" y = 1×5 string array "cody" "cody" "cody" "cody" "cody"

Assertion failed.

3   Fail
assert(isequal("cody" * 5, "cody" * 2 + "cody" * 3))

y = [] c = 5 d = "cody" y = "cody" y = 1×2 string array "cody" "cody" y = 1×3 string array "cody" "cody" "cody" y = 1×4 string array "cody" "cody" "cody" "cody" y = 1×5 string array "cody" "cody" "cody" "cody" "cody" y = [] c = 2 d = "cody" y = "cody" y = 1×2 string array "cody" "cody" y = [] c = 3 d = "cody" y = "cody" y = 1×2 string array "cody" "cody" y = 1×3 string array "cody" "cody" "cody"

Error using + Matrix dimensions must agree. Error in Test3 (line 1) assert(isequal("cody" * 5, "cody" * 2 + "cody" * 3))

4   Fail
assert(isequal(" Cody is fun! Cody is fun! Cody is fun!", 3 * " Cody is fun!"))

y = [] c = 3 d = " Cody is fun!" y = " Cody is fun!" y = 1×2 string array " Cody is fun!" " Cody is fun!" y = 1×3 string array " Cody is fun!" " Cody is fun!" " Cody is fun!"

Assertion failed.

5   Fail
assert(isequal(" Cody 5-Year Anniversary! Cody 5-Year Anniversary!", " Cody 5-Year Anniversary!" * 2))

y = [] c = 2 d = " Cody 5-Year Anniversary!" y = " Cody 5-Year Anniversary!" y = 1×2 string array " Cody 5-Year Anniversary!" " Cody 5-Year Anniversary!"

Assertion failed.

6   Fail
x = ["Cody";"matlab";"Simulink";"@Mathworks"] + (5:5:randi([1000,5000])); assert(isequal(x*2,x+x)) assert(isequal(x*3,x+x+x)) assert(isequal(5*x,x+x+x+x+x)) assert(isequal(101*x,x+100*x))