StringsEasy
Building a string with +
repeatChar builds a string of n copies of c. What's the time complexity in terms of n?
string repeatChar(char c, int n) { string s; for (int i = 0; i < n; ++i) { s = s + c; } return s;}0 of 56 answered today
repeatChar builds a string of n copies of c. What's the time complexity in terms of n?
string repeatChar(char c, int n) { string s; for (int i = 0; i < n; ++i) { s = s + c; } return s;}