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.
Certainly. Several other submitted solutions accomplish this. To be honest, my solution was in protest of the task. Obviously, a loadbalancer need not assign jobs according to their numberical value, which is to say, the status of the 'solution' after the second loop should be acceptable.
yes
It would be possible but when you go at the bottom of the "Detail" page you have "Similar Kata" where you find the others. Thanks for your post!
I'm not sure I understand. If you have solved this Kata, you can simply review all solutions, including the reference solution which is an XOR solution. On the solutions page, click on
Show Kata Test Cases
.Yes. The reference solution is a XOR solution.
I do use recursion when it is the best way to do it. I would never use a loop to traverse through a binary tree or whatever but for me, there is pain in recursion. The possibility for a stackoverflow if done incorrectly, the overhead and performance problems that can occur if you implement it naively i.e not tail optimzed.
I can only speak for myself and my own solution. I hate recursion and if a solution can be constructed without it, then I will always go for that approach.
actually, every element of
a
(in order) :PSide note: these days I would do the same thing not with a
{}
but with aMap
, so I can usemap.set(something,something)
which returns the entire updatedmap
instead of only the updated property of same. And saves on parentheses, so is easier reading. Using,
generally requires quite a few parantheses here and there.@Unnamed, thanks for posting that link!
This comment is hidden because it contains spoiler information about the solution