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.
You need something better than
O(n²)
.Hi, and welcome.
First of all, remember to indicate the language you are using when asking for help, more than 50 languages are available on CodeWars. After visiting your profile, I have assumed you have been using JavaScript.
Also, it's a good idea to include all the relevant part of the error logs you receive. I've just tried out your code on attempt tests, and I get this:
Many times, this means your code gets lost in an infinite loop and you keep pushing stuff into an array until getting out of memory and the code crashes. I advice you to have a cautious look at the following help page to debug your solution: https://docs.codewars.com/training/troubleshooting/
If you are a beginner, I would advice you to improve your skills on more basic tasks from the 8 or 7 kyu level. Some 6 kyu katas are pretty basic, but it is not the case of this one.
all single digits are narcisitic because anything to the first power is equal to itself or
x^1 = x
7 is narcisitic because of the following.
7 has one digit so I sum that one digit raised to the first power
for comparison
Use Pythontutor to visualize what your code is doing. Your code fails the second sample test.
You must return the result, not print it.
Why do you ask? The values passed in are strings of space-delineated integers. Just look at this sample test: