Code RoomString concatenation quadratic
MediumPrep Room Coding #2099

String concatenation quadratic

Code reviewAlgorithms & data structuresMid–Senior~18 min

Review this Java method that renders a CSV line-by-line.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 18 min
Mark a line and say what kind of problem it is.0 findings
1String renderCsv(List<String[]> rows) {
2 String out = "";
3 for (String[] row : rows) {
4 for (int i = 0; i < row.length; i++) {
5 out += row[i];
6 if (i < row.length - 1) out += ",";
7 }
8 out += "\n";
9 }
10 return out;
11}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.