Ad
  • Custom User Avatar

    some divide-and-conquer algorithm would speed stuff up?

  • Custom User Avatar

    just like SnowQween sad

  • Custom User Avatar

    Thank you so much for the hint.

  • Custom User Avatar

    Thank you so much, yeah I got the output right to for a 5kyu kata too but I got a long way ahead for optimization. Thanks for your advice,

  • Custom User Avatar

    You need something better than O(n²).

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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:

    <--- JS stacktrace --->
    
    FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
    

    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.

  • Custom User Avatar

    Hello my thing basically works but I'm getting this too:

    100 Random Tests
    It should works for random tests too.
    Log
    Testing for:
    n = 80350

    I'm new here can I get a hint?

  • Default User Avatar

    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

    start = 7  
    sum = 7^1  
    print (start == sum)
    -- true
    

    for comparison

    start = 20
    sum = (2^2 + 0^2)
    print (start == sum)
    -- false
    
  • Custom User Avatar

    my code works for the most part but I'm stuck with the error 'expected undefined to equal " " ' I don't actually get it. When I change it arounf instead I get 'expected " " to equal undefined'

  • Custom User Avatar

    Just realized, shame on me!!! Anyways I always find it a lot easier to find the mistake after posting for help which then I don't need. Thank you.

  • Custom User Avatar

    You must return the result, not print it.

  • Custom User Avatar

    My code returns the required results but I'm still getting:
    expected undefined to deeply equal [ +0, +0, +0 ]

  • Custom User Avatar

    Actual and expected are swapped in PHP, also assertion messages are not filled in completely for all test cases

  • Custom User Avatar

    my js code works fine in my pc, but in my attempts I get 7 is not turning TRUE, 7 shouldn't be consider a narcisitic number acording the definition given but browsing the internet I've just found for some reason all 10 numbers from 0 to 9 are considered narcisitic...

  • Loading more items...