Skip to content

Instantly share code, notes, and snippets.

@maksar
Created June 18, 2019 18:42
Show Gist options
  • Save maksar/e0e2e556f7842363b4183fbcc8e9d40e to your computer and use it in GitHub Desktop.
Save maksar/e0e2e556f7842363b4183fbcc8e9d40e 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