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.
This comment is hidden because it contains spoiler information about the solution
Great solution!
This comment is hidden because it contains spoiler information about the solution
Looks like a bug in the test suite?
.cloned()
is a more convenient way of doing.map(Clone::clone)
:)Finally another recursive solution.
Which is IMO the only sensible thing to do, considering that the return type isn't an optional.
@Renaissance8905: I use
guard
any time I can to escape early. In this case, thereturn arr
is an early escape in casetimes
equals zero. So I don't only useguard
in failure cases, but edge cases in general.The added benefit here is that we don't have to scan the
guard
body for areturn
statement, since the compiler enforces it.Nice! I like this solution a lot, but I'd use
guard
rather thanif
:)You're using
reduce
where you could (and IMO should) have just usedmap
:)This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...