5 kyu
How many strings use all symbols of a given alphabet at least once
74 of 76benjaminzwhite
Loading description...
Algorithms
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.
More like a math challenge, however nice.
suggested tag:
combinatorics
Factor translation
@Kacarott - approved, and thanks for translating!
Nice kata. Approved at kyu 5.
Thanks again for the comments, feedback and now approval @dfhwze !
Does this sequence naturally extend with larger 'a' like in your example?
nvm, -1 should have been (-1) :s
Hi @dfhwze , thanks so much for trying my kata.
To answer your question: Yes, but remember if you're going to calculate recursively like this that the multiplications for the various "missing" symbols will probably involve binomial coefficients rather than just linear 4*, 3*, 2* etc.
For example, if we read the part in the description for n=5, a=3 which says:
"So, for each of the 3 choices of F, G, or H there are exactly 2**5 - 2 = 30 forbidden strings in which exactly one of those symbols is missing, but not two of them."
in the above, the "3 choices" here is actually obtained from 3_choose_1 binomial coefficient, because you are choosing 1 symbol to omit from the 3 available.
When you have n=5 and a=4, as you consider the strings missing exactly 1,2,3 symbols, the new terms will involve binomial coefficients like this:
"With a = 4 symbols {F,G,H,I} there are 4_choose_2 = 6 (i.e. NOT just 4) ways of selecting 2 "missing symbols" to not use from these 4 sybmbols."
This comment has been hidden.
I'm not sure what would be best moving forward. Either you update the description with the 5,4 case, or you mark your previous comment as a spoiler. I do think the difficulty level of this kata depends on your decision ;)
This comment has been hidden.
This comment has been hidden.
Let's leave it as is. People are free to browse the comments section if they seek some hints.
This comment has been hidden.