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.
Very readable and simple. I like it.
Same as you, but I finally solved it after considering all the cases...
Sorry for the late reply, but you are absolutely right! Fixed now.
In the second example:
the last tuple (2,3,4,1) should have two inversions. I see three, i.e. (2,1), (3,1) and (4,1).
Shouldn't the last one be (2,3,1,4)?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Great kata! Getting the correct approach to solve it analytically didn't take that long but considering all the edge cases is pretty tedious. I don't even know if I managed to cover all of them.
This comment is hidden because it contains spoiler information about the solution
Yeah you're right. Fiddled with this one for approx an hour before a solution just magically popped into my head. My naive implementation was waaayyy to slow but I somehow thought it was the only possible approach.
Now I can do n == 16 in a few seconds without running out of heap space.
This comment is hidden because it contains spoiler information about the solution
Very nice Kata, took me quite some time.