Ad
  • Default User Avatar

    The real problem is that the JS version should be updated to match the java one... And so earn it's 3kyu rank. My solution does the job, in Java. You just have to find a more efficient algo.

    (that reminds me I still have to update the python version... :/ )

  • Custom User Avatar

    The algorithm you're using (at least for JavaScript), is incredibly slow. If you're using an analogous solution for bash, it's thoroughly unsurprising that it's not completing in time, given it's bash. Even the 'top' solution in JS is about 15x faster than what you've got, and it's quite a slow solution. I don't think it's really reasonable to force the kata maker to have set the bar so low that literally any solution will finish in time.

  • Custom User Avatar

    If you read the comments, you will see that the tests go up to 10^12(!), for which you need an efficient prime checking method. As suggested below, the ranking of the kata should be changed or the test range should be lowered. In its current state it's not a 7kyu kata, rather a 6 (or 5).