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.
sum
is not an array, but a function. Because it's called twice on each comparison during sorting, you may end up with some numbers having their sum calculated multiple times.I unfortunately wouldn't class this as best practices. My issue with this solution is it seems it's based on the test cases only. You've written the code to go "How do I make 1 turn to 0.25, or 3 to 2.25", not "How do I calculate XYZ based of ABC values"
This comment is hidden because it contains spoiler information about the solution
Why? As I understand it, the sums for each number are only calculated once. During the compare the sum array is only referenced.
That's facinating!!
freaking genius
Nice Kata, really enjoyed solving this. Thanks to everyone who contributed to it.
I completed the kata myself but this solution is greek to me. Guess I have a lot to learn
Oh wow, you're right. This is an even better solution than I first thought!
This passes tests, because
humanYears
is specified to be>= 1
. So no. There is no need to test for out of spec conditions.This is awesome, just need to add a check for humanYears === 0, I think.
I like your kata's reduce method.
Good job
I like this one. I don't entriely get it but I know what I like.
What is sumA === sumB ? Does it means each signle string number equal ?
It is indeficent, it will do the sum several times per each number
Loading more items...