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.
you could theorically even use the hard drive to store them and only load chunks to memory to be efficient. A+!
This comment is hidden because it contains spoiler information about the solution
I am not a fan of the recent edits, I think they give you the answer therefore it is too easy. But I leave the community decide
Approved
Ruby translation kumited -- please check and approve (note: author is inactive)
LGTM, Approved!!!
Since 4-2-2 contains 2 distinct sets, you have 2*7=14 points from step 1 where your organization is right.
However, there is a difference between the square of 4 and the sum of the squares of 3 and 1. That's why you shouldn't organize 4-2-2 as 1-1-1 and 3-1-1.
Test calculates the sum of the squares of 4, 2, and 2 which is 24.
So the result is 14 + 24 = 38 points.
It looks like there is something missing : if I have items like (4,2,2) I can organize them to just two sets: (1,1,1),(3,1,1) and I get
(7+3) + (7+11) = 10 + 18 = 28 points. Test says it should be 38 points. How ?
(1 Compass, 1 Gear and 1 Tablet is 3 points. 2 Compasses, 1 Gear and 1 Tablet is 6 points.) - what this condition was written for?
As a result, the kata is not about knowledge of the language and not about logic.
Scala translation
anytime
Thanks for your contributions dfhwze!
It is ok. After clicking the Attemp button, you will see the output on the left side. The first part of the output is Test Results. The first table is your results. Below, you will see another table but the content is the same: just check the upper part of the second table, you will see Results: Actual (Top 100 of 348) |
Results: Expected | Diff . If you click blue colored Results: Expected, you will see the desired results, and the Diff section shows the differences between your results and desired ones.
Hello.
After clicking the "Attempt" button you can check your results and the expected results to see the differences.
Your code failed for the test case: 3 3 7. According to your code, the result is 116 = (33 + 33 + 77) + 77 ==> your CASE statement checks whether compasses is less than gears and tablets to take it as a minimum value, but here it is equal to gears. CASE statement does the same for the gears, so it goes to the ELSE part to take tablets, which is 7, as minimum, so your code gets 49 instead of 21 for the Step 1.
You should consider the possibility of having 2 equal values that are minimum for the set, as it is the case in 3 compasses, 3 gears, 7 tablets.
This comment is hidden because it contains spoiler information about the solution
Loading more items...