Skip to content

Instantly share code, notes, and snippets.

@ELI7VH
Created March 11, 2018 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ELI7VH/ef0101aae31acbe92872e1c3accb598e to your computer and use it in GitHub Desktop.
Save ELI7VH/ef0101aae31acbe92872e1c3accb598e to your computer and use it in GitHub Desktop.
def map_dat_roman(roman_mapping, number, result = '')
if (number >= 1)
k,v = roman_mapping.find { |k, v| number / k >= 1 }
map_dat_roman(roman_mapping, number - k, result += v)
else
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment