Oh my bad you're right @Gelatomancer. The example is incorrect (my eyes slipped over the second 20...). I'll publish a new fork with the amended description. I apologize.
Please explain. With the given list [20,37,20,21] we have 20 in there twice. This goes over the given number 1, so the 2nd 20 is removed and the result should be [20,37,21], just like the kata expects. Perfect!
This is a horrendously opaque description of quite a simple concept, and for some reason the modulo operator has an included reference but not the actual problem, even though it starts "from wikipedia". From wikipedia /where/.
As it stands, the numbers you work in are in base 10. Each increment of the power moves the digit being examined one place to the left. So units, tens, hundreds etc.
The digits of the number being examined are reversed as you multiply units by units, tens by tens, hundreds by hundreds...
Repeat the process on the output of the first run. If the output matches the input, this is what he means as "stationary".
This challenge wants you to return the "stationary" number for each input.
You can submit other solutions if you want.
Accidentally clicked submit on this before fixing the first line.
Glad to have it sorted :) Apologies if my wording was at fault!
I also misunderstood what you meant, sorry!
Please approve this fork fixing an error in the description: https://www.codewars.com/kumite/622d08a51432540020e90622?sel=622d08a51432540020e90622
Oh my bad you're right @Gelatomancer. The example is incorrect (my eyes slipped over the second 20...). I'll publish a new fork with the amended description. I apologize.
Please explain. With the given list
[20,37,20,21]
we have20
in there twice. This goes over the given number1
, so the 2nd20
is removed and the result should be[20,37,21]
, just like the kata expects. Perfect!It most certainly is not perfectly correct. It's even used as one of the test cases, with the expected output as [20,37,21]
This is perfectly correct.
The description under "task" is wrong. "With list [20,37,20,21] and number 1, the result would be [20,37,20,21]."
This is a horrendously opaque description of quite a simple concept, and for some reason the modulo operator has an included reference but not the actual problem, even though it starts "from wikipedia". From wikipedia /where/.
As it stands, the numbers you work in are in base 10. Each increment of the power moves the digit being examined one place to the left. So units, tens, hundreds etc.
The digits of the number being examined are reversed as you multiply units by units, tens by tens, hundreds by hundreds...
Repeat the process on the output of the first run. If the output matches the input, this is what he means as "stationary".
This challenge wants you to return the "stationary" number for each input.
Seems a trivial problem, but it taught me the difference between types and instances.