Skip to content

Instantly share code, notes, and snippets.

@maksar
Created June 18, 2019 18:42
Show Gist options
  • Save maksar/8092d7cec581eec10720287c093f07e8 to your computer and use it in GitHub Desktop.
Save maksar/8092d7cec581eec10720287c093f07e8 to your computer and use it in GitHub Desktop.
def solution(input)
log_sum = input.map { |i| Math.log10(i) }.sum
input.map { |i| (10**(log_sum - Math.log10(i))).round }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment