Leetcode Note: Go - Thousand Separator

Thousand Separator - LeetCode
https://leetcode.com/problems/thousand-separator/

  • Go 言語で取り組んだメモ

回答

Golang simple recursive solution - Thousand Separator - LeetCode
https://leetcode.com/problems/thousand-separator/solutions/806661/golang-simple-recursive-solution/

func thousandSeparator(n int) string {
    if n < 1000 {
        return fmt.Sprintf("%d", n)
    }
    
    return thousandSeparator(n/1000) + fmt.Sprintf(".%03d", n%1000)
}