6 kyu
Array combinations
945 of 2,672KenKamau
Loading description...
Fundamentals
Combinatorics
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.
Scala translation
Approved
Nice kata. Combinatorics tag.
Added
python new test framework is required. updated in this fork
Approved
Nice!
A minor typo in the description:
.. it results in only 4 possib[I]lit[I]es.
Thanks. Fixed.
This comment has been hidden.
I think it's because you're mutating the input, which gets passed to reference solution. So, this is an issue, but you can still solve it without modifying arr.
Thank you.. that was indeed the problem.
Shouldn't test cases predict an empty subarray given, eg. solve([ [1,2], [3,4], [] ]) ? The output should be then also 4?
Hint:
[1, 2]
is not a duplicate of[2, 1]
This comment has been hidden.
This comment has been hidden.
Test solve([[1,2,3],[3,4,6,6,7],[8,9,10,12,5,6]]),72) have a bug. If we use a little combinatoric knowledge and some fingers we will see this bug. Original values in each array: [3,4,6] Ok, let's multiply them, result 3 * 4 = 12 * 6= 72.
So, 3*4=72 ?
you copied half of message
C translation available.
Thx. Approved.
Seems to be a problem with the tests. All my answers are correct but I keep getting the message : "Your answer (something I didn't return) should equal something (the answer I gave)" It's very funny because it doesn't happen all the time...
Language?
It looks like for python you set arguments in wrong order for random tests only.
Language is Python.
To be more convenient, here's an example :
The input [[8, 2, 8, 4, 4, 7, 8, 2, 5, 0, 1, 1], [8, 2, 8, 4, 4, 7, 8, 2, 5, 0, 1, 1], [8, 2, 8, 4, 4, 7, 8, 2, 5, 0, 1, 1]]
res= 216 (my result)
343 should equal 216 (the log message)
Thanks by advance.
Thanks guys. I will fix.
omg this confused me so much
Fixed now
Well Done.
Thank you
R translation kumited!
Please carefully review and approve.
Reference solution and tests are commented in the test suite. Basic tests and random test parameters are taken from the python version.
'alr approved some time ago'
I do like this idea behind this kata, but the description is extremely unclear. Let me break it down for you.
Here are the three key clauses in your description:
This is very convoluted and confusing. An outcome is the result of an experiment. In combinatorics, we're often interested in two numbers: the total number of possible outcomes of an experiment, and the number of those outcomes that have certain properties. These are two different numbers, but you're using the usage and phrasing for the second number (outcomes of interest) when you mean the first (total possible outcomes). Your phrase 2 and 3 seem to mean the same thing, based on the examples you give, but it reads like there is some outcome, not yet defined (phrase 1), then a very unclear conditional about that outcome (phrase 2), oh, and then maybe that's the outcome (phrase 3). To make things worse, your second phrase, "all members of the sub-arrays are represented" doesn't seem to have anything to do with anything in this kata. How about this instead?
Thanks. Let me look into it.
Description updated.
Much clearer now.
I think, though, you accidentally left a copy and pasted bit at the end of the description.
Thanks. Fixed.
Approved
Many thanks!