Ad
  • Custom User Avatar

    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.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This is Problem 644: Maximum Average Subarray II from LeetCode, albeit with slight changes.

  • Custom User Avatar

    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

    arr = [], k = 681: ... should equal (6078, 822)
    
  • Custom User Avatar

    The very first sentence of the task is confusing:

    Implement a function that takes an unsigned 32 bit integer as input and sorts its bytes in descending order, returning the resulting (unsigned 32 bit) integer.

    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 is 0x00 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.

  • Custom User Avatar

    The problem is identical to raulbc777's kata Shuffle It Up but with slightly more challenging tests

    The original kata already has many submitted O(n) solutions, so there's no point in this one.