n
to a string numStr
.numStr
is less than or equal to 3, return numStr
as no dots are needed.result
to build the output.count
to keep track of the number of characters processed.numStr
in reverse.
a. Prepend the current character to result
.
b. Increment count
.
c. If count
is a multiple of 3 and it's not the last character, prepend a dot to result
.result
string.