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.
From the description:
The tests exceed these specifications for
N
. Please adjust either the tests or the specifications accordingly.yeah that's the entire point of this kata
I had a solution where I used a for loop in a while loop, tried some test cases myself and it works, the only issue with this is that since the numbers can become very big in the end, the program ended up taking way too long to process since it has to generate a lot of numbers, so in the end, I cannot attempt it and submit the solution even though this code can work.
Update: I tamed it dowm to 10^5 because I plan to create a harder version of it.
Just pushed the range of k all the way to 10^9.
This comment is hidden because it contains spoiler information about the solution
oh yeah
fixed
The last digit should be
4
It's my first kata, so I don't expect my solution to be fully optimised.
By the way, can you show me an example of the
O(log(n) * log(k))
solution?What do you mean? In the description it didn't contain any underscores
Fixed
ah fck
I just fixed it on the actual test case, but not the sample
So yeah, fixed.
Example 1
should be
This is supposed to be a performance kata but author solution (aka reference solution) is inadequate: it is
O(log(n)*k)
even though a relatively simpleO(log(n)*log(k))
solution exists, as demonstrated by some solutions. The random tests are slowed by a lot by the reference solution as a result.Please replace the reference solution with an algorithm with optimal time complexity and bump up the range of
k
to make sure this is enforced.Please fix the sample tests:
Loading more items...