Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def digitDistanceNumber(n)
- x = 1
- string = n.to_s
- output = ""
- while (x < string.length)
- output = output + ((string[x].to_i - string[x - 1].to_i).abs).to_s
- x = x + 1
- end
- return output.to_i
- end
Advertisement
Add Comment
Please, Sign In to add comment