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.
Out of curiousity I benchmarked the two, this one is indeed 5 times faster.
Look at my faster solution without explicit sort. )))
The while at the beginning was a good one, it help me to optimize my solution.
Hi check out my solution, its not bruteforce like the other solution here
I have something similar, but I tried to minimize unnecessary calculations and endowed the variables with more descriptive (and longer xD) names
https://www.codewars.com/kata/reviews/55984e63be3bb762bc000138/groups/61da2a248dab43000192593e
This comment is hidden because it contains spoiler information about the solution
That's not what I mean. I meant the expression has a side effect, not the function.
++x
both increments the variablex
(a side effect) and returns the incremented value.That kind of thing is often seen as a bad practice for readability. Personally, I try to avoid it.
This comment is hidden because it contains spoiler information about the solution
Disagree with those who consider this best practices - it uses expressoins with side effects (the
++
pre-increment). It is clever, however.What's going on here? What do you call this algorithm?
This comment is hidden because it contains spoiler information about the solution