Hi, lets say i have a number like 9152 ...and its to be expanded as such : 11111111122222
(thats 9 ones and 5 twos)
so .. if i want to expand any given number ... the obvious quick solution is something like this..
but in this solution ... we do ret.length() string concats , I want to assume that this is horrible for inputs such as 9999999999.
string expand(string& input)
int expand_amount = input[i] - '0';
for(int j=0;j < expand_amount; ++j)
Anyone have a solution to making this a bit more .....clever?
(probably avoiding string concats all together)