Ad
  • Default User Avatar
    • don't need to specify splitting character: space by default
    • reduce using a binary operator like '+' can be shortened to: .reduce(:+)
    • no errors thrown if you keep the negative sign, but i like how you used abs to be clear about your intent.
  • Default User Avatar

    i really prefer this solution because it executes the given intention faithfully, and which is also suggested in the function name.