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.
That's briliant but from my point of view this loooks easier:
String numeroMaximo = Arrays.stream(Long.toString(number).split(""))
.sorted((a, b) -> b.compareTo(a))
.collect(Collectors.joining());
Oh man! I couldn't think it could have been done so clever like this :) Especially it avoids floating point computation and the hurdle of conversion floating point value to integer.
Try it without the use of Monad!
Hint: take the invers of digitToInt and the invers of show
Interesting, thanks, we'll have to look at that with a benchmark.
I'm currently learning programming, and writing random tests is part of my practice to understand different testing techniques.
the description says
It's all part of my learning journey. Thank you for your insights!
I've been wondering, do you think random tests are helpful in kumites? It looks like asserting the equality of two implementations, which only works when the reference is known to be definitely correct (in which case, why not use it in the first place instead of doing testing?).
Or maybe you're writing them just for practice, I don't know.
add random test
Good work!
A few notes if you're interested (ignore if not):
()
return type is typically omittedassert_eq!
are already equivalent toformat!
Forked with these changes and a few more. Feel free to ask me if you have any questions.