Ad
  • Custom User Avatar
  • Default User Avatar
  • Default User Avatar

    find a faster way to find divisors (maybe googling turns something up)

    you can also try finding divisors for some numbers manually, humans are optimizing problem solvers so you might .. optimize it and then do the same thing in your code

  • Custom User Avatar

    No, you still didn't understand me. You have to solve this WITHOUT calulcating factorial. Try running factorial_func(4000) and see how long it takes (spoiler: too long).

    I solved it long time ago, so I don't remember how, but I see I never calculated any factorials. This is more of a math problem.

    Also, when you post code, use it with proper formatting, otherwise we can't debug it with all indentation errors.

  • Custom User Avatar

    I don't know exactly where it's wrong, but I see that prime list doesn't contain 2, that's one of your problems (looks like incorrect ranges specified), but it's your task to debug it, not mine.

    Also, it looks like you're actually calculating the factorial itself. That's way too slow and not gonna work for bigger numbers. There's another way to solve it.

  • Custom User Avatar

    i try to solving calculating the factorial of 12 and dividing by 12 but the result is really big, and dividing 12 by 2 is 6

    Why divide by 12? Why divide 12 by 2? Where are these calculations coming from?

    12 factorial is BIG number, that's why you can keep dividing it by 2 10 times, until it's not possible anymore. I don't think you quite understood this task...

  • Custom User Avatar

    Yes.
    If your code returns an empty list, it's because you modified the input list, and it's empty.

  • Custom User Avatar

    because i always copy the elements before deleting

    No copying! You need a solution that ONLY uses the input list, and creates 0 other lists. See the post above for short explanation.

  • Custom User Avatar

    You must do the sort in place, that means you should reorder the elements of the input list, not delete its elements, only change their order.

    Your task is to implement a function that takes a list of integers and sorts it into wave order in place; your function shouldn't return anything.

  • Custom User Avatar

    The function must sort the input list in place.
    When you do "del a[min_pos]" you are deleting the input list: this is why you get empty lists in tests.

  • Custom User Avatar

    Do you know the difference between True and "True"?

  • Custom User Avatar

    Please read this: https://github.com/codewars/codewars.com/wiki/Troubleshooting-your-solution#post-discourse (I see you've already been told to do it, but, read the part aboout formatting and marking your post as having spoiler content, please).

    About your problem, you need to return a boolean, not a string like you did.

  • Custom User Avatar

    Last bullet point of this paragraph of FAQ describes your problem.

    Read this paragraph too.

    Not a kata issue.