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.
This comment is hidden because it contains spoiler information about the solution
Maybe use 'A' character value syntax instead of raw ASCII values to be more readable?
because the input is passed by reference, it's not a copy of it. So if you modify it inside your function, any other function outside that sees the exact same instance of this object will see the modifications too (even if not expected).
It changes exactly as you change the input. Think about it like it's the same instance of an object.
But if I mutate the input in the function how does it change it outside the function?
I'll tell you why that matters. The tests are written that way. They allow your function to run first, and then they do solve the problem on the data themselves. If you mutate the input, their solver takes invalid input, thus gives invalid result. It's a bad test, becacuse it's easy to make it pass every time without solving the problem, but hey! We've got what we've got.
I don't get why that matters though (and I tried that, the same thing happened though)
edit: I got my solution to work with some really weird workarounds, but it's obviously not supposed to be done like this.
Easy: don't mutate the input. ;p
I'm having the same problem, did you solve it and if so, how?
I did. And probably that's the reason.
I did it on purpose, knowing it's a bad thing, but that never was a problem so far. I guess I'm learning on my mistakes.
You are right.
Did you mutate the input?
I've got a weird error with random tests. For all of them it wants me to return just the last step, and not the whole path. Example:
Expected: ['R30'], instead got: ['L7', 'D1', 'R9', 'D1', 'L25', 'D1', 'R13', 'D1', 'L21', 'D1', 'R3', 'D1', 'R22', 'D1', 'R4', 'D1', 'L10', 'D1', 'R15', 'D1', 'L4', 'D1', 'L5', 'D1', 'L21', 'D1', 'R24', 'D1', 'L14', 'D1', 'R19', 'D1', 'R4', 'D1', 'L27', 'D1', 'L13', 'D1', 'R10', 'D1', 'R1', 'D1', 'R29', 'D1', 'L7', 'D1', 'L1', 'D1', 'L17', 'D1', 'R6', 'D1', 'R5', 'D1', 'R4', 'D1', 'L13', 'D1', 'L4', 'D1', 'L5', 'D1', 'L10', 'D1', 'R20', 'D1', 'R23', 'D1', 'L33', 'D1', 'R17', 'D1', 'L4', 'D1', 'L5', 'D1', 'R4', 'D1', 'R18', 'D1', 'L24', 'D1', 'R26', 'D1', 'L18', 'D1', 'L6', 'D1', 'L17', 'D1', 'R31', 'D1', 'R11', 'D1', 'L40', 'D1', 'R37', 'D1', 'L17', 'D1', 'R16', 'D1', 'R3', 'D1', 'L8', 'D1', 'R7', 'D1', 'L28', 'D1', 'R8', 'D1', 'L13', 'D1', 'L8', 'D1', 'R27', 'D1', 'L23', 'D1', 'R9', 'D1', 'L7', 'D1', 'R35', 'D1', 'L28', 'D1', 'L5', 'D1', 'R16', 'D1', 'L9', 'D1', 'R14', 'D1', 'R8', 'D1', 'L27', 'D1', 'R7', 'D1', 'R19', 'D1', 'L14', 'D1', 'R9', 'D1', 'R4', 'D1', 'L8', 'D1', 'R11', 'D1', 'L7', 'D1', 'L6', 'D1', 'L7', 'D1', 'L4', 'D1', 'R28', 'D1', 'L6', 'D1', 'L35', 'D1', 'R17', 'D1', 'L20', 'D1', 'R25', 'D1', 'R21', 'D1', 'L15', 'D1', 'L6', 'D1', 'L9', 'D1', 'R25', 'D1', 'L5', 'D1', 'L3', 'D1', 'L9', 'D1', 'L20', 'D1', 'L4', 'D1', 'R13', 'D1', 'L12', 'D1', 'R15', 'D1', 'R27', 'D1', 'L9', 'D1', 'L19', 'D1', 'R31', 'D1', 'L16', 'D1', 'L21', 'D1', 'R27', 'D1', 'L31', 'D1', 'L1', 'D1', 'R18', 'D1', 'L6', 'D1', 'R30']