6 kyu
Add All
158 of 968sazzadshopno
Loading description...
Fundamentals
Mathematics
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
I don't understand the instructions. You have a sum and call it cost...so what.
This comment has been hidden.
There is an error in the COBOL execution, the tests are truncating the intermediate sums to 3 positions. I think that the test is working with the same input list to calculate intermediate sums, so when it exceeds the PIC 9(3) size it is truncated. You have to use a parallel table with a PIC 9(5) for it to work correctly.
I have passed the test, but I have had to force truncate those cases, and that is not correct. That is, I have forced to pass the test but the result is wrong even though it tells me that it is correct.
I am the author of the translation. Can you give me an example of bad test logs?
You were right indeed. Thanks for reporting the bug. It should be fixed now.
Great. Thanks akar-0
Now, it works perfectly. Thanks akar-0
hopeless description, one has to guess what's going on even though the problem itself is trivial...
This comment has been hidden.
One example to get
33
for[1, 2, 3, 4, 5]
isJust generating all permutations of linear summations is not enough.
This was a straighforward kata, AFTER deciphering the expectations. The description could be written a bit more clearly. Some users are not working from a freshly studied CS algorithm textbook, and thus are actually drawing upon purely reason, logic, and programming utility, and may not associate this with the better known 'connect the ropes' to provide valuable context in the acceptance criteria. Examples showcasing the malleabillity of subsequent ordering, e.g. the cost need not necessarily be added immediately in the operation immediately following the addition of two elements.
My sollution can't pass random test. And in the all cases my cost < solution cost. However, all the basic tests and more than half of the random tests are passed correctly. Can I somehow see the conditions of random tests? Or how i can debug my solution?
Hard to give hints without spoilers.. Make sure you are actually considering the cost of each addition.
The simplest test case your solution is failing is
This was fun, thank you. I suggest to emphasize in the decription that the objective is to compute the minimal cost.
JS fork - Updated tests to Node 18.
Approved, thanks!
LC translation
this translation modifies the description. please approve Haskell first.
Haskell translation
Can anyone explain why [1,2,3,4] = 19 in the test cases? (Python) I didn't understand the task and I couldn't figure out the pattern from the test cased.
Thank you! I was struggling figuring out the step from '6 + 4 = 10, cost = 10' to 'Total = 19.'. But now I understand, it's just the sum of all calculated costs. Thank again!
i haven't solved the kata yet but the description should give more complex examples. for example given the list [1, 2, 3, 4] you don't have choose a certain permutation and work left to right (e.g. doing 1+2=3, 3+3=6, 6+4=10), you could instead add 1 and 2, then add 3 and 4 separately, then combine the two sums into one. this description doesn't cover this case and i don't know if this is done intentionally to make it harder to solve or what, i just think it's deceiving to provide only examples that make you think a certain way and essentially throw you off. i've seen this done on other katas but my rant ends here...
PS - i know the description suggests you can add numbers in this dynamic way but more examples would make this clearer. also this was a nice kata.
if you look up the (connect the ropes to minimise cost) it is much better explained there and will remove confusion because many people think for numbers [1,2,3,4,5] the minimal cost is 34 but it is actually 33'
How?? what im missing here
C++ fork that adds all missing headers.
Will resolve this issue
Approved
COBOL translation.
Can't approve because description changed. I changed the description and create fork.
Thanks!
C++ initial solution doesn't include
#include <queue>
. The tests should be fixed.Fixed.
How come [1,2,3,4,5] in sample tests should equal 34 but the same array should amount to 33 in basic tests in full test suite (Pyton 3.6)?
Log [1, 2, 3, 4, 5] 34 should equal 33 whereas: add_all([1,2,3,4,5]), 34) ?
This comment has been hidden.
I have same issue, can you please help me to undertand on how to get 33 and not 34
Much apperciated!
You have to ask yourself: is 6+4 really more optimal than 5+4?
I think this katas descriprion could use at least one more example, one which has a few more numbers to add.
Python translation available
https://www.codewars.com/kumite/5d5fea650d1cb4002a86b611?sel=5d5fea650d1cb4002a86b611
Revised version.
https://www.codewars.com/kumite/5d5fea650d1cb4002a86b611?sel=5d607950970400001d748455
I think the problem is not well explained in the kata (I know this problem as "connect the ropes" and I found that way more easy to understand). More examples would be nice and more explanation.
I agree. Once I read the explanation on Google under the name "Connect the ropes" I had no problem solving it. I think you should update the explanation part
Exelent kata,thanks.
:-D
This comment has been hidden.
Now it is fixed.
There is a test case:
[ 29, 6, 18 ]
. My answer to this is(6 + 18) + 29)
. (Cost = 24 + 53 =77
)The test in the kata expects
100
.Who is wrong here and why?
It wuold seem this test is wrong.
You don't mention if it's a fixed or a random test, or which language suffers from this. That makes it hard to fix the kata ..
Oh! Thanks!
This is happening in JavaScript and it is in the random tests.
Fixed the issue.
This comment has been hidden.
There was an issue on reference solution. It is fixed now.
C, Java, and JavaScript translations available.
Thanks, Approved!
JavaScript random tests seem to use a wrong reference algorithm. Quite possibly the other languages do as well, but I haven't checked that.
Other language works well, only javascript had the issue and it is fixed now.
In the third basic test isn't it supposed to be 34 and not 33?
This comment has been hidden.
Thanks for the help. I didn't saw that. Now I'll try again. :)
Look :-)
Look :-)
Didn't see that either
I have same issue, can you please help me to undertand on how to get 33 and not 34
Much apperciated!
Is the input always sorted like in the examples?
Nope
;-)