Nervous Bathroom Break

Logic Level 3

Imagine a bathroom with 100 urinals all lined up in a row. There's enough room in the bathroom to serve 100 people, but unfortunately, everyone's too nervous to go the bathroom next to each other!

What is the minimum number of people such that an arrangement of these people in the bathroom forces the next person who enters the bathroom to use one next to someone else?


The answer is 34.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

6 solutions

Benedict Almeda
Jul 22, 2015

To get the minimum number of people using the urinals without being next to each other, we need to get the maximum distance between two persons without giving room for another person between them. For example, if a person is four urinals away from another, a third person can still use the urinal between them without being next to either person.

Hence, the ideal distance is 3 urinals apart. So if we have the first person on one end of the row, that will leave us with 99 urinals to divide by 3. That is 99 / 3 + 1 = 34

The answer can be 33 also . Leave the first urenal and directly start from the second .

Keshav Bansal - 5 years, 9 months ago

Log in to reply

Nope. It will still be 34 even if you start with the 2nd urinal as one of the comments below says. ;)

Benedict Almeda - 5 years, 9 months ago
Egan Khomasurya
Jul 30, 2015

I used Photoshop to solve this visually. I created a canvas of 100 by 1 pixels, hence simulating the 100 urinals (one pixel = one urinal). Then, using green pixels as an occupied urinal and red pixels as all adjacent urinals, I filled out the row as such:

After that, you can either count the green pixels, or cheat and use a layer counting script to get the answer (this relies on you creating each layer being a red-green-red 3 pixel set to represent a person). By doing so, you obtain the answer 34.

Haha that's awesome

Garrett Clarke - 5 years, 10 months ago

Creativity at peaks !!

chindukuri pavan - 5 years, 8 months ago
Feathery Studio
Jul 24, 2015

As a generalization, it can be said that the minimum amount is x 3 \lceil{\frac{x}{3}}\rceil where x x is the amount of urinals, since every third urinal can be occupied thus making anyone who goes between those urinals next to someone.

Yeah, I did that too just make it an integer greater than the value if you get fractions or decimal numbers.

Bilal Akmal - 5 years, 10 months ago
Abhay Tiwari
Jul 23, 2015

Well starting with the first urinal the next person stands at fourth urinal, then 7th urinal, then tenth and so on keep adding 3 urinals, till you reach hundred. So that the gap between two persons is ONLY two urinals, By, this combination two things happen:

1) Maximum urinals are covered with minimum persons.

2) It satisfies the condition for the 35th person, to forcefully urinate next to other person.

NOTE: Two person standing with only one urinal difference is the best combination here, and takes 50 persons, before anybody is forced to pee besides someone else.

However, the first person shouldn't be at the first urinal, I don't think, should he? As we're trying to find the fewest number of people and by starting at the first urinal we use up an extra space. Surely the first person should be using the second urinal, therefore giving an answer of 33?

Ella Farley - 5 years, 10 months ago

Log in to reply

If you start from the 2nd Urinal..Then 100 will be open and it is no next to 98..So at 100 you must place a person, in order to be sure that next person will be standing next to someone..making the answer 34..

Charlz Charlizard - 5 years, 10 months ago

Log in to reply

Ah, I see - what an oversight! Thanks

Ella Farley - 5 years, 10 months ago

Nice thoughts on the maximum solution, thanks for the comment!

Garrett Clarke - 5 years, 10 months ago

Log in to reply

Well, if something nice is present here then that is your question. :)

Abhay Tiwari - 5 years, 10 months ago

Really simple, just test it. A hundred is a big number, let's try to apply with smaller numbers.

A single person can invalidate up to 3 urinals. (chosen one plus sides)

Up to 3 urinals, a single person is enough to force someone to come to their side. At 4 urinals, the bathroom needs 2 guys

5 needs 2, 6 needs 2, 7 needs 3, 8 needs 3, 9 needs 3, 10 needs 4...

You can keep on, but the pattern is already obvious, each 3 urinal we add, one more person is necessary, this can be translated to an equation, this way you can test in a more specific way to find out: f(u) = u/3 (The ONE is because we need one at the beginning)

And we can now test before putting the number of urinals we want

f(1) = 1/3 = 0.33 => round UP to get 1

f(3) = 3/3 = 1.00 => round UP to get 1

f(4) = 4/3 = 1.33 => round UP to get 2

f(7) = 7/3 = 2.33 => round UP to get 3

Alright, we went through extra work just to make sure our answer would be correct!

f(100) = 100/3 = 33.33 => round UP = 34

Chris Quinones
Jul 30, 2015

If every urinal save one was filled, you would need 99. If every urinal was filled save for two, the next person would need to stand next someone still, and you'd need 98. In the case of 97, if all three open urinals were next to each other, this would leave a "non adjacent" free urinal. So, the max free urinal chain can be two. To cover the ends of the urinal line, as the urinals there can only be "blocked" on side, you need one urinal filled right next to each end. That takes up 4 urinals, leaving 96. From there, using the two rule, adding a person to "block" adjacent urinals, means that chains of three are there on filled. So, 100 - 4 =96 and 96/3 = 32. Add the end filled urinals and the answer is 34

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...