It uses the Integer#digits method, which is effectively the same as int.to_s.chars or int.to_s.split('')
It uses the ord method to get the numeric representation of a character, but negates it to get back to an ascending order, much the same as one would do with a numeric list
join doesn't require '' as it'll assume that.
Granted there are likely better ways to go about it, but this gives some interesting ideas.
This does a few interesting things:
Integer#digits
method, which is effectively the same asint.to_s.chars
orint.to_s.split('')
ord
method to get the numeric representation of a character, but negates it to get back to an ascending order, much the same as one would do with a numeric listjoin
doesn't require''
as it'll assume that.Granted there are likely better ways to go about it, but this gives some interesting ideas.
I like it thank you!