#1556

Thousand Separator

pupil · 425 · lc easy +25 · verified · 53.7% accepted · 519 likes · top 45%

Description

Given a non-negative integer n, format it as a string using a dot "." as the thousands separator (e.g., 1234567 becomes "1.234.567").

Example 1:

Input: n = 987
Output: "987"

Example 2:

Input: n = 1234
Output: "1.234"

Code

1
2
3