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.
Wait, isn't array_shift function removes the first element of an array?
huh? 14 % 2 is not 2. izdwuut is right, it does not matter in this case.
This comment is hidden because it contains spoiler information about the solution
1^2 + 2^2 + 3^2 = 14 : (14 % 2) == 2
1^3 + 2^3 + 3^3 = 36 : (36 % 2) == 0
It metters...
Risky to use empty() - it will return true if the input is '0', meaning that calling revRot('0', 1) will return an empty string instead of '0'.
Bad solution, u need to check how to use preg_replace.
It couldn't, but it doesn't matter here, as it seems.
You missed one semicolon. ;)
This solution only takes between 6 and 10 micro seconds to be executed against more than 45 microseconds of the here first rated solution. Indeed, an insignificant difference when you process one string.
😳
Clever, but definitely not a best practice :) Very clever though 😳
From MDN website: "These [arrow] function expressions are best suited for non-method functions, and they cannot be used as constructors."
You need to add Babel to your stack (with either, Node 0.10 or 6) to make it work.
My approach was more... recursive 🙁
Good job!