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.
thanks
I agree 100% that this is an off-by-one error. If, as the description suggests, the
target_floor
(highest floor before the egg breaks) is1 <= target_floor <= max_floor
, and we are to findmax_floor
, then(n, m) = (0, 0)
implies thatmax_floor = 1
.If you instead use the definition that
0 <= target_floor <= max_floor
then this is equivalent to solving the problem from the other perspective and then subtracting1
from the resultingmax_floor
. Indeed, if you consider the algorithm for finding thetarget_floor
, and if from the start it is assumed thatk <= target_floor
for somek
, then it is useless for the algorithm to check any floors at or belowk
. This effectively shifts the algorithm's search byk - 1
places and thus shifts the resultingmax_floor
by the same amount.Respectable approach for sure, but I still feel that being able to prove the answer is what you suspect it to be is also a pretty important skill (not sure if that's what you meant or not).
Realy good Kata! Thanks to author!
Dead problem 💀
Extremely poorly explained.
Misses the point of programming exercises entirely,
as programming knowledge is completely secondary
to the task at hand.
If you're interested in Katas that involve programming, skip this one.
Exactly - if it does not break at 3, you know it will break at 4 since you tested it.
If you alter the decision tree, you'd have no idea whether floor 4 breaks eggs, you only know that floor 5 breaks eggs and floor 3 does not.
If it helps, extend your tree with the result - if you have more tries then eggs, you'll reach a result once the last egg breaks, eg. down from 1 you get the result 0, down from 2 you get the result 1,... and to the very right, next to the 10-throw you omitted if no break occurs at 9, the results are 9 or 10.
assume we have 2 eggs and 4 try
from what i understand, the decision tree behind the answer is that
the answer is 9
but if it did not break at 3 or 6 or 8, we know its 1 above it since we already tested 2 above it
so the decision tree should be
the answer should be 12
im not sure if i misunderstand it or i should put it into issue
Am I doing something wrong or are we restricted to using only BigInteger?
suggestion closed
That is really silly then. This should be on mathwars.com, not codewars.com.
This comment is hidden because it contains spoiler information about the solution
Took me a minute to understand the question, but the test values helped. The values are:
So for example if the values were
n = 1, m = 100
, the answer would be 100. Just start droppingyour one egg at floor 1 and continue up until it either breaks or you run out of tries. So you can
give the exact number for any floor up to 100. The actual floor might be 2000, but you can only verify up
to 100 with one egg. If you start on any other number, for example floor 2, the egg might break. Then
you know that floor 2 isn't safe, but you aren't sure if floor 1 is safe or not, so you can't
give a correct answer.
Whether there is an issue or not, this isn't the way to describe it.
Which language? Which random test? What's the issue with it?
Oh right, none of that is provided, so... closing.
so you're saying there's no issue?
Loading more items...