Yes, I thought about this but I'm unsure how to fix it. I thought about using RubyVM::AbstractSyntaxTree to check if the method uses for, while, until or loop but Codewars uses ruby 2.5.0 wich doesn't have the AST module.
I also thought about making the length of the array random, but then you could just loop n times calling rmap (n being the size of the array).
They're flipped everywhere.
This comment is hidden because it contains spoiler information about the solution
Yes, I thought about this but I'm unsure how to fix it. I thought about using RubyVM::AbstractSyntaxTree to check if the method uses
for
,while
,until
orloop
but Codewars uses ruby 2.5.0 wich doesn't have the AST module.I also thought about making the length of the array random, but then you could just loop n times calling rmap (n being the size of the array).
This comment is hidden because it contains spoiler information about the solution
In random tests actual and expected are flipped:
Expected: [], instead got: [32, 56, 72, 0, 40, 40, 24, 16, 48, 40]