- Given a character or a string
s
, generate a result string withn
(an integer) repeats ofs
- Given a list of characters or strings, and a list of the frequencies of their appearance (in correspondence), generate a result string with each string in the list repeated with the desired times as specified in the second list and StringJoin them together. For example, given
{"a", "b", "c"}
and{1,0,3}
, I want to have"accc"
.
I of course want to have the most efficient way of doing these. Otherwise, my own way is too ugly and slow.
Thank you for your help!