Problem 288. Construct a string from letters and counts
Given two input arrays like this: [5,3,1] ['a','b','c']
Output a string that contains each letter the specified number of times, e.g.:
'aaaaabbbc'
If given an invalid input (for example, a negative number), output the string 'ERROR'.
Solution Stats
Problem Comments
-
1 Comment
Alex Feinman
on 8 Feb 2012
Now with improved tests, and reference solution (which I'm sure you can beat).
Solution Comments
Show commentsProblem Recent Solvers143
Suggested Problems
-
Getting the absolute index from a matrix
248 Solvers
-
Make a run-length companion vector
644 Solvers
-
708 Solvers
-
15474 Solvers
-
473 Solvers
More from this Author3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!