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.
thx, for good explenation. Description isn't so good for understanding.
There is a typo in the instructions.. instead of saying 'such as' it should read 'such that'.
Every coding people should or could know that modulo 2 sum of numbers or sum of these same numbers cubed both give the same result:-) So it's up to the coder to choose... unless he/she did it because he/she did not correctly read the description (unfotunately this often happens).
I think you're right there, parity won't change with pow (unless the power is 0)
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?
This comment is hidden because it contains spoiler information about the solution
Do you mean your solution used the sum of the digits instead of the sum of the cubes of the digits and it passed the tests in Swift? If that's true, open an issue saying that.
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
Where? They're not. Cube is only used once, and it is used as the mathematical term.
Your instructions are wrong:
That means, for instance, if you get a chunk of size 3 with the digits 123 as input, the sum of the cubes of its digits is 1 + 8 + 27 = 36 that's divisible by 2 and you should reverse it.
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 asize
integer. Split thestring
into substrings of the specifiedsize
, discarding the remaining characters fewer than thesize
.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:
Combine the resulting substrings and return the result.
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