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.
The generation of test cases for random tests is taking too much time. It would be beneficial to optimize the time required for this process. You can find more information on this topic here.
This comment is hidden because it contains spoiler information about the solution
This is Problem 644: Maximum Average Subarray II from LeetCode, albeit with slight changes.
If random test fails, random test failure message uses the state of the array after being passed to user function, hence user modifying the input will display incorrect test message, e.g
The very first sentence of the task is confusing:
The confusing thing is the way how the kata mixes up values (i.e. numbers) and their internal representation (i.e. bytes). Numbers can have many different byte representations, depending on various circumstances. "Sort the bytes" can mean more than one thing.
For example, in C, since we are talking little-endian architecture here (oh, are we?), bytes are laid out in order opposite to order of 8-bit nibbles composing a number. Number
1
is0x00 00 00 01
when split into 8-bit chunks, but it's[01, 00, 00, 00]
when viewed as bytes. Bytes sorted in descending order is[01, 00, 00, 00]
, what, when composed into a number, gives us back 1. Therefore, for input 1, expected answer should be 1.The second sentence, which does not mention internal details and just states what's the desired effect, is much clearer.
The original kata already has many submitted
O(n)
solutions, so there's no point in this one.