Code RoomString concatenation in loop
MediumPrep Room Coding #1924

String concatenation in loop

Code reviewAlgorithms & data structuresMid–Senior~18 min

Review this Go function that joins many short fields into one line. It runs per log line on a high-throughput ingest path.

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
1func joinFields(fields []string) string {
2 line := ""
3 for _, f := range fields {
4 line += f + "|"
5 }
6 return line
7}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.