Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
What do you mean by "optimization"?
Both
.description
andString()
work the same way for integers - String initializer, Integer descriptionEdit:
Oh, I've noticed what you meant -
number.description.sorted {...}
? Not sure about optimization, but easier to read for sure.Looks good. You can optimize this by replacing String(number).characters with number.description
This comment is hidden because it contains spoiler information about the solution
Yes, it's elegant. But at the same time, it needs to iterate all the range from zero to n. I think this way wastes a lot of time when n is a big number.
Really nice! Very elegant.
This solution looks really smooth. I really like the logic for the tolerance, suffix and ohmsRounded constants.
People will press clever for anything that looks remotely like a one-liner... :(
Where you used .joined(separator: "\n"). I was forced to use "\n" because the compiler was actually adding a newline charater..
Any idea why?
Where you used .joined(separator: "\n"). I was forced to use "\n" because the compiler was actually adding a newline charater..
Any idea why?
I wonder why so many people voted this as a best practice. Not elegant or efficient.