Cody

Problem 2081. Concatenate strings

Solution 3024397

Submitted on 1 Oct 2020 at 22:35
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   Fail
x1 = 'a'; x2= 'b'; y_correct = 'ab'; assert(isequal(concatstrings(x1,x2),y_correct))

y = 1×2 string array "" "a" y = 1×3 string array "" "a" "b"

Assertion failed.

2   Fail
x1 = 'a'; x2= 'b'; x3= 'c'; y_correct = 'abc'; assert(isequal(concatstrings(x1,x2,x3),y_correct))

y = 1×2 string array "" "a" y = 1×3 string array "" "a" "b" y = 1×4 string array "" "a" "b" "c"

Assertion failed.

3   Fail
x1 = 'my'; x2= ' '; x3= 'holiday'; x4= ' '; x5= 'is'; x6= ' almost over!'; y_correct = 'my holiday is almost over!'; assert(isequal(concatstrings(x1,x2,x3,x4,x5,x6),y_correct))

y = 1×2 string array "" "my" y = 1×3 string array "" "my" " " y = 1×4 string array "" "my" " " "holiday" y = 1×5 string array "" "my" " " "holiday" " " y = 1×6 string array "" "my" " " "holiday" " " "is" y = 1×7 string array "" "my" " " "holiday" " " "is" " almost over!"

Assertion failed.

4   Pass
assert(isempty(concatstrings()))

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!