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.
To answer the question, not quite. If you had two eggs and 14 tries, and observed the first egg break on the Nth try, you then have one egg and 14-N tries remaining. In other words, the tries are cumulative. Notice therefore that increasing
n
beyondm
has no effect, since you can use up at mostm
eggs no matter your strategy.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).
Fixed both
Updated. Thanks.
This comment is hidden because it contains spoiler information about the solution
Hear, hear! Not using the Oxford Comma ranks with asinine behavior such as not using a turn signal or standing on an escalator. An excellent example of the problem with omitting the Oxford Comma can be found in a line from an actual Times of London story: "Highlights of his global tour include encounters with Nelson Mandela, an 800-year-old demigod and a dildo collector." Without the comma after "demigod", the sentence can certainly take on an unintended meaning. The Oxford Comma never causes any harm, but can often offer clarity. LONG LIVE THE OXFORD COMMA!!!!!
ips_between
Because 41 is greater than 1, so you normally use plural.
Why 41 minute[s], but not 41 minute[]?
Oxford comma, anyone?
You can look at other's solutions to see their approaches ;-)
This comment is hidden because it contains spoiler information about the solution
In python specifically (don't know about other languages), the predefined test cases are all of lengths divisible by three, which makes for very clean encoding and decoding. Among the random cases, however, those that violate this property are inevitably encountered. It would be helpful if some of the predefined/sample cases had this property so that it would be easier to debug an issue related to this.
Python translation awaiting approval at http://www.codewars.com/kumite/5ab2c20e9186c6db87000019.