Skip to content

Instantly share code, notes, and snippets.

@raul-gracia
Last active July 25, 2016 21:44
Show Gist options
  • Save raul-gracia/9694024 to your computer and use it in GitHub Desktop.
Save raul-gracia/9694024 to your computer and use it in GitHub Desktop.
Kata: Grouped by commas

Kata: Grouped by commas

Finish the solution so that it takes an input 'n' (integer) and returns a string that is the decimal representation of the number grouped by commas after every 3 digits.

Assume: 0 <= n < 1000000000

1 -> "1"

10 -> "10"

100 -> "100"

1000 -> "1,000"

10000 -> "10,000"

100000 -> "100,000"

1000000 -> "1,000,000"

35235235 -> "35,235,235"

def solution(n)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment