Please don't make an unnecessary copy of that array when you can achieve comparable readability without doing so. Sorry, but I would definitely not consider that solution best practice.
This is my first translation. If I've done anything wrong then tell me and I'll try to fix it :)
Just realised that the tests aren't done in random order.
This comment is hidden because it contains spoiler information about the solution
+1
This is what I was attempting but fell short. Very clever.
Please don't make an unnecessary copy of that array when you can achieve comparable readability without doing so. Sorry, but I would definitely not consider that solution best practice.
This is my first translation. If I've done anything wrong then tell me and I'll try to fix it :)Just realised that the tests aren't done in random order.