Cute riddle: Four kids holding one toy balloon
blog.ram.rachum.com
blog.ram.rachum.com
And remember, no matter what, there's only one correct answer: the one the interviewer wants to hear. Very rarely do I see a new and correct answer to these puzzle questions provoke a positive response.
I hit the back button and moved on with my life.
What would be interesting would be to have a site that solved the problem of puzzle sharing and cooperation. Has anyone done that?
If it really matters to you then you can write down the solution so others will know you got it first, but most people don't care about the credit, they just love the sharing of puzzles and other fun stuff.
It doesn't seem to work online - there are always those who insist on "sharing" just how clever they are.
To be fair I always love when an "interview question" article shows up and we get 500 versions of fizzbuzz implemented in the most mind bending way possible.
Apply this recursively: https://dl.dropbox.com/u/388822/balloon.png
Works for any number of children.
- we have balloons with no rings (just a knot ;-))
- we can't add any rings (cheating!)
- we can make rings out of strings
--------------------------------------------------
Solution: 1 string that makes a ring under the balloon, 1 that goes through that ring and has two rings at each end. 1 string through 1 ring for kid #1 and #2, 1 string through the other ring for kid #3 and #4. 4 strings in total ( general function f(N,M) => f(4,1) = 4 )
For 1 balloon an three kids you need 3 strings (1 as a ring under the balloon, 1 string through the ring. One end is held by kid #1, other end is a ring. 1 string through that ring and the ends are hold by kid #2 and #3) f(3,1) = 3. Likewise: f(2,1) = 2 f(1,1) = 1 <= trivial
Now for M balloons with M > 0. For 1 balloon you can have 1 string that makes a ring, for 2 balloons 1 string as well (interconnected). For 3 balloons you need 2 strings from 1 to 2 and from 2 to 3. Ergo: for M balloons you need M-1 strings.
Consider the fact that having 2 balloons or 100 balloons, you only need to attach a string to one of these interconnecting strings to float all the balloons if you release this string.
Hence: M balloons and 2 kids needs the same amount of strings for for example 1 balloon and 2 kids plus the interconnecting strings.
From here it follows that for M > 1 (and N>0) the general function is: f(N,M) = (N-1) + (M-1) (in words: you need M-1 interconnecting strings and one string less than the number of kids)
3D plot: http://www.wolframalpha.com/share/clip?f=d41d8cd98f00b204e98...
"We show how to hang a picture by wrapping rope around n nails, making a polynomial number of twists, such that the picture falls whenever any k out of the n nails get removed, and the picture remains hanging when fewer than k nails get removed"
The problem: hang a painting with one unbroken piece of rope going from one corner of the painting to another around two nails such that if either nail is removed the painting will fall.
0: not holded
binary AND: ==O--
binary OR: ==>--
So the generalized riddle for any monotone boolean function can be easily solved because all boolean monotone functions can be built up of binary ORs and ANDs.
(Edit: accidentally mixed up OR and AND, fixed now.)
Finally, a thread passes through each ring of thread A; let's call them threads B1 and B2. Each kid holds one end of threads B1 and B2.
If for example one of the ends of thread B1 is lost by its kid, B1 will slip out of the ring on thread A, and thread A will subsequently slip out of the ring on the balloon. The ballon flies away :)
Each string acts as one chain link. Kid technically could hold both ends of their string, but you could tie it if kid holding one string was an absolute condition.
> "How are the threads arranged?"
So the whole 4 separate threads idea still holds if we assume the balloon will lift the kids off the ground. That was a bit of a huge hole in the riddle. It should have been noted that the children were immovable anchors. Feynman would have had a field day with this.