Thousand Separator
EasyStringssimulation
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Given a non-negative integer n, return its decimal representation as a string with a dot (.) inserted between every group of three digits, counting from the right.
Numbers with three or fewer digits are returned unchanged, and there is never a leading dot.
Examples
Input: n = 987
Output: "987"
Three digits need no separator.
Input: n = 1234
Output: "1.234"
The last three digits form one group, leaving 1 in front.
Input: n = 0
Output: "0"
Zero is written as a single digit.
Constraints
- 0 <= n <= 2^31 - 1
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.