• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 23:31
CET 04:31
KST 12:31
  • 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
[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5
Community News
Weekly Cups (October 19-25): Clem triples first in 5.0.174Evil Geniuses - shutting down20ISSL (IntoTheTV x SOOP SC2 League): Premier5Weekly Cups (October 12-18): 5.0.17 era begins1[$1250] International ShieldBattery League92
StarCraft 2
General
No more SC2 streamers on team liquid? How do you feel about the mass reverts in the 5.0.17 PTR? Weekly Cups (October 19-25): Clem triples first in 5.0.17 Evil Geniuses - shutting down REPORT: StarCraft 2: Remastered In Development
Tourneys
Stellar Fest TWO the Moon (Dec 16-20) RSL 2026 Offline Finals LCQ Sign-Ups Sparkling Tuna Cup - Weekly Open Tournament 2026 KungFu Cup Announcement RSL goes to London! 2026 Offline Finals Nov 21-22
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
Simple Questions/Answers [G] How to playtest arcade maps [A] Nemrods 1/4 players
External Content
Mutation # 549 Endless Sparkles The PondCast: SC2 News & Results Mutation # 548 Shining Bright Mutation # 547 Temple Of Terror
Brood War
General
BW General Discussion Rollback Netcode in Brood War SC4ALL II Brood War Complete Invited Player Lineup Sagi.gg Launcher Released Starcraft player cRuZa Passed away.
Tourneys
Small VOD Thread 2.0 [Women's StarCraft] MonstarZ vs BA 2026-10-30 [IPSL] IPSL Winter 26-27 Ro24 is HERE! [Megathread] Daily Proleagues
Strategy
50,000-Word Terran Builds Memo 2026-10-22 Cliff Jump Revisited (1 in a 1000 strategy) Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Mobile Legends: Bang Bang Armies of Exigo - YesYes? General RTS Discussion Thread
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine R I P Patrick Stewart European Politico-economics QA Mega-thread
Fan Clubs
Reynor Fan Club The Flash Fan Club Serral Fan Club
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
Can Bots Beat Pros?? Starcr…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 9375 users

brain teaser - Page 2

Blogs > Shady Sands
Post a Reply
Prev 1 2 3 4 Next All
synapse
Profile Blog Joined January 2009
China13814 Posts
November 20 2012 23:17 GMT
#21
With the 2-rock limit I don't think the binary search works... you would have a worst-case of both rocks instantly breaking if the floor was <25
:)
KaRnaGe[cF]
Profile Joined September 2007
United States355 Posts
November 20 2012 23:38 GMT
#22
If you drop any one rock more than once, it will damage the integrity of the rock making it useless to use in the test again.
"We must remember that one man is much the same as another, and that he is best who is trained in the severest school." - Athenian General Thucydides Quantum Gaming
Aerisky
Profile Blog Joined May 2012
United States12129 Posts
November 21 2012 00:35 GMT
#23
Yeah I think this is a standard CS interview question to see how you are with logic/creativity and what have you.

I am sooo bad at logic puzzles/brain teasers though lol ;__;. Maybe I shouldn't go through with a technical field and/or EECS after all. And karnage the assumption is that the rock sustains no damage until it hits the breaking point, whereupon the rock immediately and completely breaks. Otherwise you can't actually do the puzzle lol.
Jim while Johnny had had had had had had had; had had had had the better effect on the teacher.
farvacola
Profile Blog Joined January 2011
United States18870 Posts
Last Edited: 2012-11-21 00:41:55
November 21 2012 00:41 GMT
#24
I like this problem more if it includes an acknowledgement of the damage each rock receives per drop, which is then itself contingent on the distance of the fall. With that in mind, find the shortest total distance needed for both rocks to break.
"when the Dead Kennedys found out they had skinhead fans, they literally wrote a song titled 'Nazi Punks Fuck Off'"
Complete
Profile Joined October 2009
United States1864 Posts
November 21 2012 02:05 GMT
#25
On November 13 2011 13:34 Complete wrote:
14,27,39,50,60,69,77,84,90,95,99,100
worst case 14


My answer from another thread with this question.
ClysmiC
Profile Blog Joined December 2010
United States2192 Posts
November 21 2012 02:49 GMT
#26
Binary selection doesn't work. Assume you have a 100 story building and it breaks on the 20th story.

You drop the first one at 50, it breaks. You drop the second one at 25, it breaks. Both your rocks are now broken and you can't continue testing. If you had unlimited number of rocks, then yes, binary selection is the fastest way. That being said, I'm not sure what the fastest way is ^_^
snively
Profile Blog Joined August 2011
United States1159 Posts
November 21 2012 03:01 GMT
#27
I just realized... it says "brian teaser" and not "brain teaser"
xD
My religion is Starcraft
brian
Profile Blog Joined August 2004
United States9644 Posts
November 21 2012 03:24 GMT
#28
seriously. As a Brian, I can confirm this is #1 most annoying thing in the world.
Shady Sands
Profile Blog Joined June 2012
United States4021 Posts
Last Edited: 2012-11-21 04:39:51
November 21 2012 03:36 GMT
#29
On November 21 2012 12:24 Gene wrote:
seriously. As a Brian, I can confirm this is #1 most annoying thing in the world.


=/ bah

edit: ty mystery mod
Что?
DarkPlasmaBall
Profile Blog Joined March 2010
United States46626 Posts
November 21 2012 06:21 GMT
#30
I agree with the "10 steps of 10" starting point. It seems in general you want your second rock to be responsible for the same number of steps as your first rock, assuming the worst case scenario- that your first rock breaks on the first try. From there, the answer is trivial.
"There is nothing more satisfying than looking at a crowd of people and helping them get what I love." ~Day[9] Daily #100
peidongyang
Profile Joined January 2009
Canada2084 Posts
Last Edited: 2012-11-21 06:39:01
November 21 2012 06:29 GMT
#31
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 throws never bothered me anyway
Blazinghand *
Profile Blog Joined December 2010
United States25563 Posts
November 21 2012 06:31 GMT
#32
On November 21 2012 15:21 DarkPlasmaBall wrote:
I agree with the "10 steps of 10" starting point. It seems in general you want your second rock to be responsible for the same number of steps as your first rock, assuming the worst case scenario- that your first rock breaks on the first try. From there, the answer is trivial.


Yeah the thing is, if you do 10 steps of 10 as a starting point you quickly realize it's not optimal. Let's say you drop at 10, 20, 30, etc all the way up to 80. Where do you drop now? Well, you could drop at 90, but then your first rock is responsible for 1 step and your second rock could be responsible for 10. So basically your initial increment should be bigger than 10, and by the time you get to 100 it should be pretty small. This ends up being increment of 14, 13, 12, 11, and so on, so that each time, even later on, both rocks are responsible for the same amount of chance.
When you stare into the iCCup, the iCCup stares back.
TL+ Member
DarkPlasmaBall
Profile Blog Joined March 2010
United States46626 Posts
Last Edited: 2012-11-21 06:49:23
November 21 2012 06:43 GMT
#33
On November 21 2012 15:31 Blazinghand wrote:
Show nested quote +
On November 21 2012 15:21 DarkPlasmaBall wrote:
I agree with the "10 steps of 10" starting point. It seems in general you want your second rock to be responsible for the same number of steps as your first rock, assuming the worst case scenario- that your first rock breaks on the first try. From there, the answer is trivial.


Yeah the thing is, if you do 10 steps of 10 as a starting point you quickly realize it's not optimal. Let's say you drop at 10, 20, 30, etc all the way up to 80. Where do you drop now? Well, you could drop at 90, but then your first rock is responsible for 1 step and your second rock could be responsible for 10. So basically your initial increment should be bigger than 10, and by the time you get to 100 it should be pretty small. This ends up being increment of 14, 13, 12, 11, and so on, so that each time, even later on, both rocks are responsible for the same amount of chance.


Well can't you adjust after each drop, so that every step would hypothetically cause your second rock to require the same amount of floor responsibility as the first one, if the first rock broke at any given step? I'm just concerned about the starting point for starters.

If you start at floor 10 and the first rock does break, the the second rock will then be responsible for 10 floors (1-9). If the first rock didn't break, then you need to account for the other 90 floors. I'm not suggesting that you always go up in increments in 10 (although looking back at my post, I totally could have chosen better words- I just meant the starting point though), as I do agree with your reasoning that then the first rock would be doing less work (so to speak) in accounting for fewer relative groups, whereas the second rock would always need to do increments of 10. But then we would just keep rounding (perhaps via square roots? I don't know; I'm tired) such that the first and second rocks are always hypothetically responsible for the same amount of work (the first rock being the larger division and then the second rock having an equal sub-division in case the first rock breaks at any time) at any given step.

EDIT: So I guess for the second step, assuming the first rock doesn't break and there are 90 floors left... drop the first rock at ~sqrt(90), or 9 or 10 floors, up, so that the second rock can also cover that many floors in case the rock breaks? If the first rock attempted to cover more to make your job easier, you'd fall behind on your counting if it breaks. If you cover fewer floors in an attempt to ensure the rock doesn't break, then you still have potentially many more floors to go in the long run.

Or is it the case that with all of these cumulatively smaller increments, it ends up being slightly larger overall than if you happened to just plain start off with a bigger number for the first rock drop than floor 10? Is there a justification for this other than working out all the calculations?
"There is nothing more satisfying than looking at a crowd of people and helping them get what I love." ~Day[9] Daily #100
GhandiEAGLE
Profile Blog Joined March 2011
United States20754 Posts
Last Edited: 2012-11-21 07:08:15
November 21 2012 07:07 GMT
#34
=============Ignore==============
Oh, my achin' hands, from rakin' in grands, and breakin' in mic stands
Cyber_Cheese
Profile Blog Joined July 2010
Australia3615 Posts
Last Edited: 2012-11-21 09:28:36
November 21 2012 09:27 GMT
#35
On November 21 2012 15:31 Blazinghand wrote:
Show nested quote +
On November 21 2012 15:21 DarkPlasmaBall wrote:
I agree with the "10 steps of 10" starting point. It seems in general you want your second rock to be responsible for the same number of steps as your first rock, assuming the worst case scenario- that your first rock breaks on the first try. From there, the answer is trivial.


Yeah the thing is, if you do 10 steps of 10 as a starting point you quickly realize it's not optimal. Let's say you drop at 10, 20, 30, etc all the way up to 80. Where do you drop now? Well, you could drop at 90, but then your first rock is responsible for 1 step and your second rock could be responsible for 10. So basically your initial increment should be bigger than 10, and by the time you get to 100 it should be pretty small. This ends up being increment of 14, 13, 12, 11, and so on, so that each time, even later on, both rocks are responsible for the same amount of chance.

I think this changes the average to be better too
The 10 example works out to ~ 11 average (if I'm not mistaken.) The average number of guesses the first rock will take is the average of the sum of 1->10 which is 5.5, then the second rocks the same for 11 total.
As a worst case scenario, it goes to 19 (10,20,30...100 =10), when it breaks on 99 or 100 (Because it has to break somewhere right?) You have to test 91,92,93....99.
with 14+13... it's a little more complicated to find an average, the first rock has 12 possibilites, but it's an average of (x?), because the early ones are more likely to show up, and then the second one has 11 possibilites, but an average of (y?) because the ones the cooincide with a large number of rock 1 drops will require less rock 2 drops
If I did x+y, it'd be manually tallying, I suspect someone knows a better way?
The moment you lose confidence in yourself, is the moment the world loses it's confidence in you.
Rannasha
Profile Blog Joined August 2010
Netherlands2398 Posts
November 21 2012 09:51 GMT
#36
On November 21 2012 18:27 Cyber_Cheese wrote:
Show nested quote +
On November 21 2012 15:31 Blazinghand wrote:
On November 21 2012 15:21 DarkPlasmaBall wrote:
I agree with the "10 steps of 10" starting point. It seems in general you want your second rock to be responsible for the same number of steps as your first rock, assuming the worst case scenario- that your first rock breaks on the first try. From there, the answer is trivial.


Yeah the thing is, if you do 10 steps of 10 as a starting point you quickly realize it's not optimal. Let's say you drop at 10, 20, 30, etc all the way up to 80. Where do you drop now? Well, you could drop at 90, but then your first rock is responsible for 1 step and your second rock could be responsible for 10. So basically your initial increment should be bigger than 10, and by the time you get to 100 it should be pretty small. This ends up being increment of 14, 13, 12, 11, and so on, so that each time, even later on, both rocks are responsible for the same amount of chance.

I think this changes the average to be better too
The 10 example works out to ~ 11 average (if I'm not mistaken.) The average number of guesses the first rock will take is the average of the sum of 1->10 which is 5.5, then the second rocks the same for 11 total.
As a worst case scenario, it goes to 19 (10,20,30...100 =10), when it breaks on 99 or 100 (Because it has to break somewhere right?) You have to test 91,92,93....99.
with 14+13... it's a little more complicated to find an average, the first rock has 12 possibilites, but it's an average of (x?), because the early ones are more likely to show up, and then the second one has 11 possibilites, but an average of (y?) because the ones the cooincide with a large number of rock 1 drops will require less rock 2 drops
If I did x+y, it'd be manually tallying, I suspect someone knows a better way?


The second option (14,13,12...) averages at 10.36 drops. Determined by just averaging the number of drops from all possible heights.
Such flammable little insects!
Cyber_Cheese
Profile Blog Joined July 2010
Australia3615 Posts
Last Edited: 2012-11-21 10:27:20
November 21 2012 10:26 GMT
#37
On November 21 2012 18:51 Rannasha wrote:
Show nested quote +
On November 21 2012 18:27 Cyber_Cheese wrote:
On November 21 2012 15:31 Blazinghand wrote:
On November 21 2012 15:21 DarkPlasmaBall wrote:
I agree with the "10 steps of 10" starting point. It seems in general you want your second rock to be responsible for the same number of steps as your first rock, assuming the worst case scenario- that your first rock breaks on the first try. From there, the answer is trivial.


Yeah the thing is, if you do 10 steps of 10 as a starting point you quickly realize it's not optimal. Let's say you drop at 10, 20, 30, etc all the way up to 80. Where do you drop now? Well, you could drop at 90, but then your first rock is responsible for 1 step and your second rock could be responsible for 10. So basically your initial increment should be bigger than 10, and by the time you get to 100 it should be pretty small. This ends up being increment of 14, 13, 12, 11, and so on, so that each time, even later on, both rocks are responsible for the same amount of chance.

I think this changes the average to be better too
The 10 example works out to ~ 11 average (if I'm not mistaken.) The average number of guesses the first rock will take is the average of the sum of 1->10 which is 5.5, then the second rocks the same for 11 total.
As a worst case scenario, it goes to 19 (10,20,30...100 =10), when it breaks on 99 or 100 (Because it has to break somewhere right?) You have to test 91,92,93....99.
with 14+13... it's a little more complicated to find an average, the first rock has 12 possibilites, but it's an average of (x?), because the early ones are more likely to show up, and then the second one has 11 possibilites, but an average of (y?) because the ones the cooincide with a large number of rock 1 drops will require less rock 2 drops
If I did x+y, it'd be manually tallying, I suspect someone knows a better way?


The second option (14,13,12...) averages at 10.36 drops. Determined by just averaging the number of drops from all possible heights.

Did you include that '14' would be 14 drops, because you don't know if the rock broke at 13 or not? Same with 27,39,50,60,69,77,84,90,95,99
The moment you lose confidence in yourself, is the moment the world loses it's confidence in you.
Flonomenalz
Profile Joined May 2011
Nigeria3519 Posts
Last Edited: 2012-11-21 10:30:38
November 21 2012 10:30 GMT
#38
wrong thread
I love crazymoving
AcrossFiveJulys
Profile Blog Joined September 2005
United States3612 Posts
Last Edited: 2012-11-21 11:02:00
November 21 2012 10:35 GMT
#39
On November 21 2012 06:40 Shady Sands wrote:
+ Show Spoiler +

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 "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 at floor X, the answer is floor X-1; if it doesn't break, the floor X is the answer.


Another interpretation of the "at most 2 identical rocks" condition would be that you start with a (known finite? infinite?) number of rocks in which at most 2 are identical, and you are trying to find the highest floor that some rock breaks. In this scenario, the optimal strategy depends on how many rocks you start with which you didn't tell us.

Yet another (loose) interpretation is that we start with an infinite number of identical rocks. In this case the optimal strategy is a binary search: try floor ceil(N/2), if a rock breaks, try floor ceil(N/4), and if not try floor ceil(3*N/4), and so on. The maximum number of drops will be ceil(log_2(N)).
Cyber_Cheese
Profile Blog Joined July 2010
Australia3615 Posts
November 21 2012 10:45 GMT
#40
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?
The moment you lose confidence in yourself, is the moment the world loses it's confidence in you.
Prev 1 2 3 4 Next All
Please log in or register to reply.
Live Events Refresh
Next event in 8h 30m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ViBE157
CosmosSc2 63
SortOf 10
StarCraft: Brood War
GuemChi 2079
ProTech142
Dewaltoss 113
Force[name] 6
Dota 2
NeuroSwarm168
League of Legends
Doublelift3742
JimRising 649
Counter-Strike
taco 656
Other Games
summit1g10420
Coldzera 680
WinterStarcraft413
C9.Mang0179
[ Show 14 non-featured ]
StarCraft 2
• davetesta24
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• Azhi_Dahaki27
• Pr0nogo 5
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Stunt178
Other Games
• Scarra1014
• Shiphtur64
Upcoming Events
GSL
8h 30m
Epic.LAN
9h 30m
Big Brain Bouts
13h 30m
OSC
18h 30m
Replay Cast
19h 30m
Sparkling Tuna Cup
1d 6h
WardiTV Invitational
1d 8h
Epic.LAN
1d 9h
IPSL
1d 12h
eOnzErG vs McRibbed
LancerX vs StRyKeR
AI Arena Tournament
1d 14h
[ Show More ]
OSC
2 days
Yamato Cup
2 days
IPSL
2 days
Artosis vs RiceHat
Kyrie vs Sony
Map Test Tournament
2 days
WardiTV Weekly
3 days
Ultimate Battle
3 days
Rush vs BeSt
Replay Cast
3 days
Rogue vs Classic
Patches Events
4 days
PiGosaur Cup
4 days
Kung Fu Cup
5 days
The PondCast
6 days
KCM Race Survival
6 days
Liquipedia Results

Completed

Proleague 2026-10-28
Blizzard Classic Cup 2026
HCC Season 3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026
Esports World Cup 2026

Upcoming

IPSL Winter 2026-27
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
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 © 2026 TLnet. All Rights Reserved.