Ad
  • Custom User Avatar

    For all SQL beginners here, there are multiple very decent, FREE websites to learn SQL commands. For people who are bit more advanced, check out SQL murder mystery, its great.

  • Custom User Avatar

    I think there should be an example where a term of the sum is divided more than one time. For example:
    k-divide(8, 2) = sum(1, 1, 3, 1, 5, 3, 7, 1) = 22
    The first time I didn't catch the part about repeating the operation, as the instruction mentioned dividing twice. My fault, but I think the it could be rewritten clearer and shorter. Maybe

    For each integer from 1 to N, perform the following operation:

    1. If the number is divisible, divide by K, and repeat
    2. Otherwise, end the operation
  • Custom User Avatar

    Like others said, some code solves this kata in 1 second. So it CAN get optimised.

  • Custom User Avatar

    It doesnt fail your random test, your code supposedly is just unoptimized and takes too long to calculate, like my code, but I dont see a way how to optimize my code even further

  • Custom User Avatar

    My solution passes all the 63 tests, but fails the random tests.

  • Custom User Avatar

    Like said, it doesnt get much more optimized than it is rn

  • Custom User Avatar

    Your code is too slow for this problem. Large values of N (up to $10^{18}$) are tested and your solution should be able to handle such values.

  • Custom User Avatar

    Author's solution passes all tests below 1 second. Are you sure that your code is optimized at all?

  • Custom User Avatar

    The servers are too slow.... and I think my code doesnt get much more optimized than it is

    Execution Timed Out (12000 ms)
    Why did my code time out?
    Our servers are configured to only allow a certain amount of time for your code to execute. In rare cases the server may be taking on too much work and simply wasn't able to run your code efficiently enough. Most of the time though this issue is caused by inefficient algorithms. If you see this error multiple times you should try to optimize your code further.