Skip to main content
added 88 characters in body
Source Link
Eric Duminil
  • 1.1k
  • 8
  • 12

Ruby, 38 bytes

->s{s.bytes.inject(0){|a,b|b-48+a*10}}

35 bytes with the new Ruby 2.7 syntax:

->s{s.bytes.inject(0){_2-48+_1*10}}

Try it online!

Ruby, 38 bytes

->s{s.bytes.inject(0){|a,b|b-48+a*10}}

Try it online!

Ruby, 38 bytes

->s{s.bytes.inject(0){|a,b|b-48+a*10}}

35 bytes with the new Ruby 2.7 syntax:

->s{s.bytes.inject(0){_2-48+_1*10}}

Try it online!

Source Link
Eric Duminil
  • 1.1k
  • 8
  • 12

Ruby, 38 bytes

->s{s.bytes.inject(0){|a,b|b-48+a*10}}

Try it online!