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.
This comment is hidden because it contains spoiler information about the solution
Never mind
I don't understand the description either
This is very unlikely to happen, you have been extremely (un)lucky. Random tests are ok for small values (tests are designed in a very common manner, it is not problematic normally).
Looks like python from their profile
The description is absolutely unambiguous:
That means you have in total
n
eggs, and in totalm
tries. Once an egg is broken you cannot use it anymore. From there you must reason, what you have begun to do, but no need to share it publicly (that's why I marked your comment with a spoiler flag), and find the solution.Random tests in Python are very weak: only two big tests, with some luck a naive solution can pass.
Done
It is the same in all katas, for all languages. The code is compiled once (when needed), then the tests are launched in a row, they are not isolated, and memoizing is definitively not cheating, no matter what you may believe or not. It's a current practice; several katas encourage to use it, and it might even be necessary for some of them (though I have no concrete example in memory).
@akar-0 Well, normally you try to make sure your test cases ARE isolated, so the outcome of one test does not affect any other.
In case of isolated test cases memoisation won't give you any advantage, because any cache collected by the previous test case should be cleared.
If it's not the case here, and you use this fact to your advantage, then yes, I believe it's cheating in this context.
Even if it would be a viable strategy in a real-world task.
Though if a faster algorithm does exist, then this kata does not rely on the test case interference, which makes the point moot.
Python:
should be removed from sample tests.
Language?
And what you name cheating is not; it's an optimization technique. Though it is neither sufficient nor necessary here, apparently.
Your current approach is O(n), but there exist O(log(n)) approaches.
Loading more items...