6 kyu
Sum of integer combinations
223 of 381KenKamau
Loading description...
Arrays
Fundamentals
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.
python new test framework is required. updated in this fork
Approved
Python: Random tests are vulnerable to input modification
Fixed by OP
i ve passed all basic tests, but failed with every random test: But for example: find([1, 2, 3, 4, 5, 6] ,6) should return 9, but there are 11 tuples fullfilling the condition: (6,),(1, 5),(2, 4),(3, 3),(1, 1, 4),(1, 2, 3),(2, 2, 2),(1, 1, 1, 3),(1, 1, 2, 2),(1, 1, 1, 1, 2),(1, 1, 1, 1, 1, 1).
C++: random tests may generate arrays with zeros. According to the description, all array elements must be positive (and it is true for other languages).
Here is a fork which fixes this issue.
Approved!
Really a 6?
ZED.CWT's solution is just amazing!
Waw! So easy in Python (thanks to standard library modules), true headache in JS, at least for me! Thanks for this kata, I've learnt a lot solving it and I'll learn much more looking at other's solutions! Next challenge will be to solve it in C++... O_o
Shouldn't be too hard to move from JS code to C++. Good luck.
Well... I need to improve skills about C++ maps... Thanks ;)
This comment has been hidden.
An interesting kata. I'm on my way to solve it - didn't get it yet.
C++ translation <a href=https://www.codewars.com/kumite/5a66da838803851ea800008d?sel=5a66da838803851ea800008d>here :)
Thanks for approving :)
Hopefully I didn't mess up!
Um... Though it is guessable what to do, wouldn't it be better if you make it clear that the arrangement should not be longer than the given list ? Like
find([1,4,5,8],8)
does not includes[1,1,1,1,1]
and[1,1,1,1,4]
. Or it is infered by the wordarrangements
itself ? Figuring it out is part of this kata ?Thanks ZED. I have just included a note in the description.
Resolved.
o_O
Hi,
Why:
find([1,2,3],10)
should return0
while one could do1+3+3+3 = 10
? Isn't the description missing a condition?Because you can't go beyond the length of the initial array, otherwise there will be too many possibilities.
[1,3,3,3]
has a length of4
, whereas the length should be max of3
=>length[1,2,3] = 3
.ok, but you have to explain that condition in the description, so. ;)
Done!