Ad
  • Default User Avatar

    Done. Though I'm not sure if you can test for this actually. Like if you cube an even number, wouldn't you always get an even number, and vice versa?

  • Default User Avatar

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

  • Custom User Avatar

    Hm, I might've misinterpreted the rules then, in which case - my bad. The only reason that was my assumption is that my solution didn't involve the cube part. But now that you point this out, it does seems a lot more plausible that that part of the rule just isn't covered in tests, and that I should've followed the instructions better :P

  • Default User Avatar

    The description of this is incomprehensible, far more difficult than the challenge itself (not saying it's easy, just that the description is unreasonably hard). Like why is "chunk" used interchengably with "cube"? Especially since cube is an established mathematical term, which made this even more confusing. Very frustrating.

    Here's my attempt of rewriting this:

    The input is a string of integers and a size integer. Split the string into substrings of the specified size, discarding the remaining characters fewer than the size.

    If the size is 0 or less, or is greater than the length of the string, return "".

    Implement an algorithm transforming each substring as follows:

    • If the sum of the substring's digits is a multiple of 2, reverse that substring ("123" > "321").
    • Otherwise, rotate the substring to the left by one position ("135" > "351")

    Combine the resulting substrings and return the result.

  • Custom User Avatar

    The goal is to basically implement the Brainfuck compiler. Took me a while to understand the problem myself, but I think understanding how the language itself works (rather than just the various commands it has) really helps, I found this video to be a good overview: https://www.youtube.com/watch?v=-3C200nCwpk