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.
Turns out to be a math challenge, rather than programming. Very challenging test suite.
I agree.
Great kata! Touches a couple of side problems. I learned something.
Implemented a deterministic solution with complexity O(n^3) in Python. Solves 70-by-70 puzzles in <10s on my laptop.
Nice game. This is 5% coding, 95% thinking.
Great kata. Sounds simple, turns out to be very challenging.
Thanks.
CONTIGUOUS. There is only one 2 next to 3.
Sorry, I don't understand the example {2,2,2,3}.
If subarray {2} is counted three times, why is {2,3} only counted once?
(unfortunately, the answer to nekoman's question is hidden)
Well done!
I'm not a big fan of regex, but this demonstrates it can help to concentrate on the essential stuff, leaving all the tokenization on a single line.
Perfect iterators!
I think four conditions should cover everything.
In order not to miss anything, shouldn't the exceptions be caught around each condition separately?
https://oeis.org/A002326
I tried with strings of length 0-100. It seems to be always cyclic, but the number of repetitions is not a trivial sequence.
Results for length 0,2,4,...,100 (length+1 is the same cycle size):
1,2,4,3,6,10,12,4,8,18,6,11,20,18,28,5,10,12,36,12,20,14,12,23,21,8,52,20,18,58,60,6,12,66,22,35,9,20,30,39,54,82,8,28,11,12,10,36,48,30,100
How to calculate that for any length?
Intersting kata.
By repeating the shuffling scheme, will we always get back to the original sequence at some point? How many repetitions will it take, as a function of the sequence length?