Cody

Solution 2077246

Submitted on 2 Jan 2020
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
x = []; y = []; y_correct = 'ERROR'; assert(isequal(construct_string(x,y),y_correct))

Assertion failed.

2   Fail
x = [-1]; y = ['a']; y_correct = 'ERROR'; assert(isequal(construct_string(x,y),y_correct))

a = 1×0 empty char array out = 0×0 empty char array

Assertion failed.

3   Pass
x = ['a']; y = [5]; y_correct = 'ERROR'; assert(isequal(construct_string(x,y),y_correct))

out = 'ERROR'

4   Pass
r = 10+randi(20); x = [r 1]; y = 'ab'; y_correct(1:r) = 'a'; y_correct(r+1) = 'b'; assert(isequal(construct_string(x,y),y_correct))

a = 'aaaaaaaaaaaaaaaaaaaaaaaa' out = 'aaaaaaaaaaaaaaaaaaaaaaaa' a = 'b' out = 'aaaaaaaaaaaaaaaaaaaaaaaab'

5   Pass
x = [5 4 3 2 1]; y = '.#4a5'; y_correct = '.....####444aa5'; assert(isequal(construct_string(x,y),y_correct))

a = '.....' out = '.....' a = '####' out = '.....####' a = '444' out = '.....####444' a = 'aa' out = '.....####444aa' a = '5' out = '.....####444aa5'

6   Pass
x1 = [1 1 1 1 1 1]; y = 'banana'; assert(isequal(construct_string(x1,y),y))

a = 'b' out = 'b' a = 'a' out = 'ba' a = 'n' out = 'ban' a = 'a' out = 'bana' a = 'n' out = 'banan' a = 'a' out = 'banana'