Cody

# Problem 288. Construct a string from letters and counts

Solution 816081

Submitted on 29 Jan 2016 by William
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
%% x = []; y = []; y_correct = 'ERROR'; assert(isequal(construct_string(x,y),y_correct))

y = ERROR

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

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

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))

y = 97 97 97 97 97 97 97 97 97 97 97 97 97 y = 97 97 97 97 97 97 97 97 97 97 97 97 97 98

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

y = 46 46 46 46 46 y = 46 46 46 46 46 35 35 35 35 y = 46 46 46 46 46 35 35 35 35 52 52 52 y = 46 46 46 46 46 35 35 35 35 52 52 52 97 97 y = 46 46 46 46 46 35 35 35 35 52 52 52 97 97 53

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

y = 98 y = 98 97 y = 98 97 110 y = 98 97 110 97 y = 98 97 110 97 110 y = 98 97 110 97 110 97

### Community Treasure Hunt

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

Start Hunting!