Skip to content

Instantly share code, notes, and snippets.

@mykhailokrainik
Created January 9, 2023 16:36
Show Gist options
  • Save mykhailokrainik/327b80849a97252fa52035d10be40a61 to your computer and use it in GitHub Desktop.
Save mykhailokrainik/327b80849a97252fa52035d10be40a61 to your computer and use it in GitHub Desktop.
def multiplication(a,b)
m = {}
while a >= 1
m[a] = b
a = a / 2
b = b * 2
end
m.select { |k, _| k % 2 != 0 }.values.sum
end
describe 'RPM' do
it 'multiplication 11 * 11' do
expect(main(11, 11)).to eq(121)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment