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.
I've included an explanation of array lengths tested. I hope it's helpfull.
Tests take and return strings now.
All done! Random tests are added and tests take and return str values. Thanks ;)
All done!
Thanks for the comments!
When testing large numbers, all my results have one extra palindrome. For example, when testing n= 1000000 is 60, n=5000000 is 78 and so on. I’ve checked each palindrome one by one and they all are correct. For example for n= 1000000 last one is 964469 (5662 + 5672 + 5682), for n=5000000 last one is 3187813 (12622, 1263**2). Is there an error in test results for large numbers?
But you still iterate over every digit. So if the number passed is as large as 1000 digits this solution could be very slow.
Great Kata! It made me think a lot. Though, I cannot pass the test because my results do not have a '-' between units and tens. i.e. 'twenty two' is not equal 'twenty-two'. Now I need to modify my code to add '-' in correct places in order to pass the test. Not good!
This code does look short, though if you try it on a large data it takes quite a while to return the result