Integer to String with Comma Separators (itoa variant)

Implement a variant of itoa: given an integer n, convert it to a string, inserting a comma every three digits from the right as a thousands separator. Handle negative numbers and zero.

Examples...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: