Two egg dropping puzzle variation: unknown/infinite floors

后端 未结 2 1032
忘了有多久
忘了有多久 2021-01-27 10:50

Preface

This problem was inspired by a similar question last week on SO, that got deleted before it was clear what the real question was. I think this

2条回答
  •  执笔经年
    2021-01-27 11:26

    The sub-optimal solution for the infinite problem for two eggs is to use the sequence 1, 2^2, 3^3,... ,i^2,... and start the second edge where the last value the first egg remains. So if the first edge remains at n^2, then the next one will do at most 2*n + 1 - 1 (minus 1 from the first) test to give the total of 3 * n in the worst case with n = sqrt(m).

提交回复
热议问题