• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 20:28
CEST 02:28
KST 09:28
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL52Weekly Cups (June 23-29): Reynor in world title form?12FEL Cracov 2025 (July 27) - $8000 live event16Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
The SCII GOAT: A statistical Evaluation The GOAT ranking of GOAT rankings Statistics for vetoed/disliked maps How does the number of casters affect your enjoyment of esports? Esports World Cup 2025 - Final Player Roster
Tourneys
Korean Starcraft League Week 77 Master Swan Open (Global Bronze-Master 2) RSL: Revival, a new crowdfunded tournament series [GSL 2025] Code S: Season 2 - Semi Finals & Finals $5,100+ SEL Season 2 Championship (SC: Evo)
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Flash Announces Hiatus From ASL BGH Auto Balance -> http://bghmmr.eu/ Player “Jedi” cheat on CSL Unit and Spell Similarities Help: rep cant save
Tourneys
[Megathread] Daily Proleagues [BSL20] Grand Finals - Sunday 20:00 CET Small VOD Thread 2.0 [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Trading/Investing Thread Russo-Ukrainian War Thread The Games Industry And ATVI
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 624 users

brain teaser - Page 3

Blogs > Shady Sands
Post a Reply
Prev 1 2 3 4 Next All
Ota Solgryn
Profile Blog Joined January 2008
Denmark2011 Posts
Last Edited: 2012-11-21 10:50:26
November 21 2012 10:48 GMT
#41
On November 21 2012 06:40 Shady Sands wrote:
Imagine you have, at most, two identical rocks and a 100-floor building.

Using only the method of dropping a rock from a certain floor and seeing whether it will crack open or not, what is the least number of drop attempts you need to use to figure out the highest floor from which a rock, dropped, will not break?

1) Breaking is ordinal--a rock that breaks from a 60 floor etc. can be safely assumed to break from a 70 floor drop, etc.

Once you have calculated this for the 100-floor building, what is the answer for an n-floor building?


The least number of drops you need to use is 2. You drop the first rock from n+1 floor -> it breaks. You drop the next rock from n floor -> it doesn't break. So now you know the highest floor from which is doesn't break is the n floor.

The answer cannot be 1 (the rock breaks at 1st floor) because then there would be no floor from which the rock would be intact. This is unless you are allowed to use the exclusion principle and just drop one rock from the 2nd floor and you then know the rock would be intact on the 1st floor (then it would be only 1 drop).

I did it this way becuase the question is the least number of drops.
Most people here seem to calculate what is the maximum number of drops you would need to use in the case you have the most optimal way of generally finding the highest floor of which the rock would be intact.
ihasaKAROT: "Wish people would stop wasting their lives on finding flaws in others"
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
November 21 2012 10:59 GMT
#42
On November 21 2012 19:45 Cyber_Cheese wrote:
Show nested quote +
On November 21 2012 19:35 AcrossFiveJulys wrote:
The "at most 2 identical rocks" condition is confusingly worded. One interpretation would be that you start with either 1 rock or 2 identical rocks, and if a rock breaks, you can't drop it anymore. So the challenge is that if you break all rocks you start with without finding a floor in which a rock doesn't break you can't say with certainty any floor in which a rock does not break.

So under that interpretation, if you start with 1, the only strategy that is guaranteed to give you an answer is to start at floor 1 and continue upwards until the rock breaks; the floor before the one in which it breaks is the answer. If you start with 2, the best strategy that is guaranteed to give you an answer would be one in which you ascend 2 floors at a time and drop one rock at each floor until it breaks. Then you try the other rock on the floor below. If it breaks, the answer is the floor below; if it doesn't break, the current floor is the answer.


.... What? The first rock exsists to narrow down the range such that the second could act as your only rock example. What if the answer was 99? Are you seriously calling 51 potential drops optimal?


Mmmm you're right. It's 6am here ><
Clazziquai10
Profile Blog Joined August 2011
Singapore1949 Posts
November 21 2012 11:39 GMT
#43
I think the question needs to be rephrased into something like this:

How do you drop the rocks in such a way that yields the best worst-case scenario? i.e. the worst case scenario for a particular way to drop the rocks would require the lowest number of drops compared to other ways to do so
Rannasha
Profile Blog Joined August 2010
Netherlands2398 Posts
November 21 2012 12:47 GMT
#44
On November 21 2012 19:48 Ota Solgryn wrote:
Show nested quote +
On November 21 2012 06:40 Shady Sands wrote:
Imagine you have, at most, two identical rocks and a 100-floor building.

Using only the method of dropping a rock from a certain floor and seeing whether it will crack open or not, what is the least number of drop attempts you need to use to figure out the highest floor from which a rock, dropped, will not break?

1) Breaking is ordinal--a rock that breaks from a 60 floor etc. can be safely assumed to break from a 70 floor drop, etc.

Once you have calculated this for the 100-floor building, what is the answer for an n-floor building?


The least number of drops you need to use is 2. You drop the first rock from n+1 floor -> it breaks. You drop the next rock from n floor -> it doesn't break. So now you know the highest floor from which is doesn't break is the n floor.

Except you don't know what n is.

I did it this way becuase the question is the least number of drops.
Most people here seem to calculate what is the maximum number of drops you would need to use in the case you have the most optimal way of generally finding the highest floor of which the rock would be intact.


What you answered is the least number of drops you need to verify that the highest non-breaking-floor is n, when n is provided a priori. If n is not known, you need to the "best worst-case-scenario", which is what people have been calculating.
Such flammable little insects!
Rannasha
Profile Blog Joined August 2010
Netherlands2398 Posts
November 21 2012 12:52 GMT
#45
On November 21 2012 15:29 peidongyang wrote:
Base case: For 0 rocks we are able to determine whether or not 1 floor is passable (we assume it is)
Recursive Relation: a(n)=2*a(n-1), where n is the number of rocks
Proof
For 1 rock, we are able to drop it from floor 1 and if it breaks, and it won't break from floor 0
For 2 rocks, we are able to drop it from floor 2. If it breaks, we drop it from floor 1. If not, we will drop it from floor 3. Therefore we are able to determine breaking from floors 1-4.

Without going into rigorous mathematical proof, it is very easy to see that 2^n floors can be determined with n rocks, or the reserve, the binary search tree with log(2)n time.

Therefore the solution for 100 floors is ceil(log(2)100).

The general solution is ceil(log(2)n)

edit2: nvm again I think my solution holds. Guaranteed to produce result in 7 searches


The problem only allows you 2 rocks, your solution requires more. Specifically, if the rock already breaks on the first floor, your binary search tree requires you to break 7 rocks. This is why binary search trees are not a correct way of approaching the problem. (The problem would be rather dull otherwise, since binary search trees are such a common technique.)
Such flammable little insects!
Incze
Profile Blog Joined December 2011
Romania2058 Posts
November 21 2012 13:17 GMT
#46
But if a rock would normally break when thrown from, say, the 50th floor, then if it's already been dropped from all the previous floors, it won't be able to reach 50, it would break much sooner because each fall, no matter how small affects its structural integrity.
Religion: Buckethead
Rannasha
Profile Blog Joined August 2010
Netherlands2398 Posts
November 21 2012 13:31 GMT
#47
On November 21 2012 22:17 Incze wrote:
But if a rock would normally break when thrown from, say, the 50th floor, then if it's already been dropped from all the previous floors, it won't be able to reach 50, it would break much sooner because each fall, no matter how small affects its structural integrity.


It's an abstract problem. The only reason it's described with physical concepts such as rocks and floors is to make it accessible. In this case, you must assume that the rocks is completely unaffected by a drop that doesn't outright break it. If you can't do that, I can give you a purely mathematical description of the problem.
Such flammable little insects!
Ota Solgryn
Profile Blog Joined January 2008
Denmark2011 Posts
Last Edited: 2012-11-21 13:47:09
November 21 2012 13:46 GMT
#48
On November 21 2012 21:47 Rannasha wrote:
Show nested quote +
On November 21 2012 19:48 Ota Solgryn wrote:
On November 21 2012 06:40 Shady Sands wrote:
Imagine you have, at most, two identical rocks and a 100-floor building.

Using only the method of dropping a rock from a certain floor and seeing whether it will crack open or not, what is the least number of drop attempts you need to use to figure out the highest floor from which a rock, dropped, will not break?

1) Breaking is ordinal--a rock that breaks from a 60 floor etc. can be safely assumed to break from a 70 floor drop, etc.

Once you have calculated this for the 100-floor building, what is the answer for an n-floor building?


The least number of drops you need to use is 2. You drop the first rock from n+1 floor -> it breaks. You drop the next rock from n floor -> it doesn't break. So now you know the highest floor from which is doesn't break is the n floor.

Except you don't know what n is.

Show nested quote +
I did it this way becuase the question is the least number of drops.
Most people here seem to calculate what is the maximum number of drops you would need to use in the case you have the most optimal way of generally finding the highest floor of which the rock would be intact.


What you answered is the least number of drops you need to verify that the highest non-breaking-floor is n, when n is provided a priori. If n is not known, you need to the "best worst-case-scenario", which is what people have been calculating.


No, I provided the least number of drops you need if you make a lucky guess, I do not need to know n, nowhere does the question state that you could not make guess, and be lucky with that guess. Anyhow, I just answered it as was it a trick question, which to me it is, because of a vague formulation.
ihasaKAROT: "Wish people would stop wasting their lives on finding flaws in others"
DarkPlasmaBall
Profile Blog Joined March 2010
United States44191 Posts
Last Edited: 2012-11-21 14:32:01
November 21 2012 14:25 GMT
#49
On November 21 2012 22:46 Ota Solgryn wrote:
Show nested quote +
On November 21 2012 21:47 Rannasha wrote:
On November 21 2012 19:48 Ota Solgryn wrote:
On November 21 2012 06:40 Shady Sands wrote:
Imagine you have, at most, two identical rocks and a 100-floor building.

Using only the method of dropping a rock from a certain floor and seeing whether it will crack open or not, what is the least number of drop attempts you need to use to figure out the highest floor from which a rock, dropped, will not break?

1) Breaking is ordinal--a rock that breaks from a 60 floor etc. can be safely assumed to break from a 70 floor drop, etc.

Once you have calculated this for the 100-floor building, what is the answer for an n-floor building?


The least number of drops you need to use is 2. You drop the first rock from n+1 floor -> it breaks. You drop the next rock from n floor -> it doesn't break. So now you know the highest floor from which is doesn't break is the n floor.

Except you don't know what n is.

I did it this way becuase the question is the least number of drops.
Most people here seem to calculate what is the maximum number of drops you would need to use in the case you have the most optimal way of generally finding the highest floor of which the rock would be intact.


What you answered is the least number of drops you need to verify that the highest non-breaking-floor is n, when n is provided a priori. If n is not known, you need to the "best worst-case-scenario", which is what people have been calculating.


No, I provided the least number of drops you need if you make a lucky guess, I do not need to know n, nowhere does the question state that you could not make guess, and be lucky with that guess. Anyhow, I just answered it as was it a trick question, which to me it is, because of a vague formulation.


While I understand that possible ambiguity/ need to be clever, I'm also pretty sure that based on the context, you really understood that it wasn't a trick question. It means for any given floor, the fact that you're always looking to optimize your answer (not just "get lucky"), and the understanding that you can't risk both rocks breaking without knowing for a fact what the correct floor is. You can't just arbitrarily say, "I choose to pick the two perfect floors to give me the correct answer, meaning the answer's two", because you're incapable of knowing for sure that you'd pick those two ideal floors. You'd need to already know the answers, and then drop the rocks to reconfirm them. However, as the person dropping the rocks, you don't actually know yet what those ideal floors are.

I mean, after all, if you really want to be a dick about it, why not just say, "Well I was super lucky in my individual trial because the answer was "the rock breaks at the first floor" and I dropped my first rock on the first floor and it broke, and therefore I didn't even need the second rock. Answer's one." It's really missing the point of the brain teaser, because if it hadn't broken, I would have only eliminated one floor in one step, and I'd still have ninety-nine to go... and you simply can't work under the assumption that it will be the first floor, so it's silly to pick floor one to drop the first rock. It will be better for you (probability-wise) to drop the first rock at floor two at step one than at floor one.
"There is nothing more satisfying than looking at a crowd of people and helping them get what I love." ~Day[9] Daily #100
Scorch
Profile Blog Joined March 2008
Austria3371 Posts
November 21 2012 14:50 GMT
#50
I'd throw the first rock in increases of sqrt(n) (floors 10, 20, 30... in our example), and of course the second rock in single steps from the last known safe position. That yields a worst case of 2*sqrt(n). Probably not optimal, but should be decent enough for starters.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 21 2012 15:05 GMT
#51
In case you missed it, Phael posted the right answer on page 1. There's no way to improve on it because all the worst case scenarios for rock 2 yield the same result, and it deals with the worst case scenario for rock 1, floor 99/100, as well with the same upper limit. Well ok, that wasn't a real proof. But since we're dealing with minima and integer values, proving it might be ugly...
If you have a good reason to disagree with the above, please tell me. Thank you.
Warillions
Profile Joined November 2010
United States215 Posts
November 21 2012 15:53 GMT
#52
half split method
green.at
Profile Blog Joined January 2010
Austria1459 Posts
November 21 2012 19:18 GMT
#53
+ Show Spoiler +
my initial thought is n/2 if i start on floor 2 and go up 2 each time it does not break, gonna think about it some more
Inputting special characters into chat should no longer cause the game to crash.
vaL4r
Profile Joined May 2010
Germany240 Posts
Last Edited: 2012-11-21 23:16:20
November 21 2012 23:01 GMT
#54
On November 21 2012 06:40 Shady Sands wrote:
what is the least number of drop attempts you need to use to figure out the highest floor from which a rock, dropped, will not break?


+ Show Spoiler +
Two. I drop my first rock from floor X which just so happens to be the floor above the one from which it won't break, of course at this time I don't know this.. not until I drop the rock from the floor X-1 and discover it is intact!

In case I am missunderstanding I could be wrong but it seems to me as thought this was a silly trick question and not a puzzle with a clever mathematical answer.

I would appreciate if you told me which one is


EDIT: oh nvm I get it.. so the idea is that if the rock doesn't break I can pick it up and use it again so the question is which is the most effective method for finding the floor without breaking more than 2 rocks.

Meh I don't see it! Seems like too much of a shot in the dark - I would start by throwing it from the [ highest floor - 1 ],
if it doesn't break you can go test the highest floor, if it does I would just go back to floor 0 and go one up every throw...

every other method I can come up with on the fly seems flawed in that it could be really bad depending on what the right floor number actually is.
You need to play starcraft with a light heart. If you play with a heavy heart, you can't win. -NaDa
Z-BosoN
Profile Blog Joined May 2007
Brazil2590 Posts
November 22 2012 00:38 GMT
#55
Well, if you have a large wooden plank that you can pin outside the windows and you are very precise in throwing the rocks, you need but one rock =p
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
Last Edited: 2012-11-22 01:24:32
November 22 2012 01:05 GMT
#56
This is actually a nice problem looking at it in a non-zombie state today. It's a sequential decision making problem but the objective is to minimize the worst-case number of steps needed subject to the condition that you cannot break both rocks.

Here's my solution which ends up more rigorously deriving Phael's solution. So you drop the first rock on some floor x_1. If it breaks, you are forced to start from floor 1 and increase to x_1-1 until the rock breaks, at which point you know the answer in x_1 steps. If it doesn't break, you get to choose another floor x2 to drop the first rock, where if it breaks you have to ascend from floor x_1+1 to x_2-1, which makes you take x_2-x_1+1 steps. Extending this reasoning to general x_k, the worst case becomes x_k - x_{k-1} + k-1.

So the problem can be formulated as choosing x1, x2, ..., xN to minimize max_k {x_k-x_{k-1}+k-1},

Let the number of steps that strategy G takes given the answer is F be G(F). Now consider the space of strategies that contains those that are valid (always outputs a solution) and never perform useless drops (ones that give no additional information); call that space S. Obviously this space of strategies contains the optimal strategy. Then for all G in S, G(F) summed over F=1 to N is the same. I think this is a safe assertion that could be easily proved via a proof by contradiction.

Then, we conclude that in order to minimize the maximum number of steps, the number of steps required for each possible F in the optimal strategy should be the same. So we need to find x_1, ..., x_M such that x_k-x_{k-1}+k-1 for all k from 1 to M, and where M <= N. The unique solution to that recurrence relation is Phael's solution.
Shady Sands
Profile Blog Joined June 2012
United States4021 Posts
November 22 2012 01:49 GMT
#57
FYI, I heard this in a Google interview. I guess this is somehow related to indexing and searching webpages?
Что?
zlefin
Profile Blog Joined October 2012
United States7689 Posts
November 22 2012 01:53 GMT
#58
1.
since question is poorly formulated; i get to interpret it to my convenience.
drop it from the top floor, if it doesn't break, it won't break at any floor; hence
it is the highest floor from which a rock dropped will not break (since tehre is no higher floor).
question doesnt' say whether to look for best or worst case scenarios; so i choose best case
Great read: http://shorensteincenter.org/news-coverage-2016-general-election/ great book on democracy: http://press.princeton.edu/titles/10671.html zlefin is grumpier due to long term illness. Ignoring some users.
LockeTazeline
Profile Blog Joined June 2012
2390 Posts
November 22 2012 02:18 GMT
#59
I think:

+ Show Spoiler +
Drop it from the midway point of the available floors, rounded up.

Longest solve (answer 1st floor):
-50 (break)
-25 (break)
-13 (break)
-7 (break)
-4 (break)
-2 (break)
-1 (break)

=7

Overall: Log 2 of n. (rounded up)
targ
Profile Blog Joined December 2010
Malaysia445 Posts
November 22 2012 03:50 GMT
#60
On November 21 2012 06:55 AiurZ wrote:
fastest way to find out is to drop from 10th floor, then 20th floor, then 30th floor, etc. until it breaks and then you drop the 2nd rock ascending each floor 1 by 1.

for an n-floor building u just find the minimum of (n/x)+x=y and that is the amount of floors u skip each try (for a 100 floor building it is 10).


This was my original idea too, just get the minimum of (n/x)+x-1=y, I think you missed out the -1, because say you drop and break on the tenth floor then you only need to drop the second rock nine times. However this only yields the optimal solution in the case that x is fixed, so it is less optimal that the 14 + 13 + 12... solution.

Binary search would be fastest if we had more rocks, but since we only have two its not workable.
http://billyfoong.blogspot.com/ my other opinions are here
Prev 1 2 3 4 Next All
Please log in or register to reply.
Live Events Refresh
Next event in 2h 32m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 269
Livibee 117
RuFF_SC2 65
StarCraft: Brood War
HiyA 50
NaDa 28
Dota 2
420jenkins376
capcasts128
NeuroSwarm82
febbydoto6
League of Legends
JimRising 683
Counter-Strike
taco 963
Other Games
summit1g9682
tarik_tv6652
fl0m575
ViBE190
PPMD49
Organizations
Other Games
BasetradeTV73
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH153
• Hupsaiya 91
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki8
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• masondota21132
League of Legends
• Doublelift4577
• Jankos1570
Upcoming Events
Korean StarCraft League
2h 32m
CranKy Ducklings
9h 32m
RSL Revival
9h 32m
ByuN vs Cham
herO vs Reynor
FEL
15h 32m
RSL Revival
1d 9h
Clem vs Classic
SHIN vs Cure
FEL
1d 11h
BSL: ProLeague
1d 17h
Dewalt vs Bonyth
Replay Cast
2 days
Sparkling Tuna Cup
3 days
The PondCast
4 days
[ Show More ]
Replay Cast
4 days
RSL Revival
5 days
Replay Cast
5 days
RSL Revival
6 days
Liquipedia Results

Completed

BSL 2v2 Season 3
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.