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.
suggested tags:
combinatorics, permutations
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/142.
Please join the discussion to help us identify duplicate kata and retire them.
JS should be updated to
Node 14.x
andBigInt
.This comment is hidden because it contains spoiler information about the solution
C++ Translation
The function name should be in snake_case in Python and Ruby.
Kotlin translation waiting for review
Something I did not find in the instruction is the possibility to find repeated words in the dictionary.
If you generate all possible permutations of a 'word' having repeated letters, you will generate a number of repetitions. For example:
starting from "eke" you will generate [('e', 'e', 'k'), ('e', 'e', 'k'), ('e', 'k', 'e'), ('e', 'k', 'e'), ('k', 'e', 'e'), ('k', 'e', 'e')],
which contains 2 copies each of 3 different words.
Is the solution you want the position of the given word in the full permutations list (in the example, both 2 and 3 would be correct),
or its position in the list of UNIQUE words, where the correct answer would be 1? (of course, numbers starting from 0)
This took me a really long time (almost the whole day) and I struggled a lot. I found the previous exercises in the series fairly simple but this one I really struggled with.
I plodded on, searching online for various things and I seemed to be progressing. I started by commenting out all but the first / simplest test, and worked to get that working. Once it did, I uncommented the next... now I have to deal with the iteration on creation... then I revealed the next one etc... that definitely made it more manageable... but then when submitting, I hit the createFilter tests... I swear, it simply wasn't clear to me how that was supposed to work at all. At this point I was guessing and it seemed like no combination of logic would get my tests to pass.
Eventually I did 'reveal solutions' which meant that I didn't get credit for completion, but I actually learned that I was super close and it was simpler than I thought.
I would have like to have seen the createFilter tests in the main Kata versus hidden until submission.
I got through, and I think I learned something about streams and conversions etc., but I have to be honest I don't think I'll retain what I took from creating the custom functions or predicate... They still seem obtuse to me and when I look at the code that was created as a result, it doesn't necessarily make sense to me why I'd use these.
Really enjoyed the series, thank you! This one was tough for me.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
My Python solution fails with large input if I use reduce to compute the product of factorials, and works just fine if I use a for loop instead. Any idea why that happens?
@Azuaron, shall we use more specialized
Predicate<Student>
instead ofFunction<Student, Boolean>
?Why the type signture is different in exponential one?
Is it possible to implement one with type signature Cnum a -> Cnum a -> Cnum a?
This comment is hidden because it contains spoiler information about the solution
Loading more items...