This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programming Diversions and the fly likes Post your favorite trick questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "Post your favorite trick questions" Watch "Post your favorite trick questions" New topic
Author

Post your favorite trick questions

salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

Mike Simmons wrote:I think six is the minimum number of people involved. (Well, for, how shall I put it... traditional family trees. ) One solution is to take Salvin's answer and send E or F home. We need one or the other, but we don't need both. Or we can send them both home, if we can augment G with another cousin of opposite gender.

They are both required actually.


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2982
    
    9
salvin francis wrote:
Mike Simmons wrote:I think six is the minimum number of people involved. (Well, for, how shall I put it... traditional family trees. ) One solution is to take Salvin's answer and send E or F home. We need one or the other, but we don't need both. Or we can send them both home, if we can augment G with another cousin of opposite gender.

They are both required actually.

For what?

Let's just discuss the first solution I proposed (since that seems to be what you're replying to.) Take your solution and send F home - I assert that we don't need her. Now I'll copy and paste your previous explanation, with minor alterations to cover F's absence. My alterations are in bold:

If i am a guy - A
and i came with my sis - B
and my mom - C
and my Dad - D
and my Mon/Dad's Brother - E
[omit F]
and his son/daughter - G.

1. someone was there with their mother. A to C
2. someone was there with their father. A to D
3. someone was there with their sister. A to B
4. someone was there with their brother. B to A
5. someone was there with their son. C or D to A
6. someone was there with their daughter. C or D to B
7. someone was there with their aunt. G to C
8. someone was there with their uncle. A or B to E
9. someone was there with their neice. E to B
10. someone was there with their nephew. E to A
11. someone was there with their cousin. A or B to G

Total = 6
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

wow, thats right,
now why didnt that strike me

good work
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
    
    3
Mike Simmons wrote:I think six is the minimum number of people involved. (Well, for, how shall I put it... traditional family trees. ) One solution is to take Salvin's answer and send E or F home. We need one or the other, but we don't need both. Or we can send them both home, if we can augment G with another cousin of opposite gender.


Six is still higher than I'm looking for. And yes, we're talking about traditional family trees. i.e. nothing like I'm My Own Grandpa.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11145
    
  16

Ryan McGuire wrote:Six is still higher than I'm looking for. And yes, we're talking about traditional family trees. i.e. nothing like I'm My Own Grandpa.

In that case, I'll say 5.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
    
    3
Mike Simmons wrote:
salvin francis wrote:
Ryan McGuire wrote:
salvin francis wrote:
There is a Titar in front of a Titar
There is a Titar behind a Titar
Titar in front,
Titar behind,
How many Titar in all ?


Let's see... I drew a diagram of the scenario described. I have a row of 15 titars side-by-side. In front of the fifth one is one more titar, so...
16. Final answer.


Answer = 3

[Titar][Titar][Titar]


Two seems sufficient.


But we all know that titar have an overly developed "personal" protection drive, bordering on paranoia, when just one other titar is present. Therefore, any time only two titar are in close proximity to each other it usually results in a frenetic battle to the death. This would result in a puzzler more like, "Titar triumphantly on top of Titar; Titar bleeding to death under Titar; How many Titar in all?" The only time there can be multiple (live) titar in a small area is when there is three or more, thus making Salvin's answer of three quite correct indeed.

Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
    
    3
fred rosenberger wrote:...I'll say 5.


Show your work.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11145
    
  16

Ryan McGuire wrote:
fred rosenberger wrote:...I'll say 5.


Show your work.
The solution is obvious, and is left as an exercise for the reader.
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1006
    
    3
fred rosenberger wrote:
Ryan McGuire wrote:
fred rosenberger wrote:...I'll say 5.


Show your work.
The solution is obvious, and is left as an exercise for the reader.


Let me be a little moe specific with the problem statement:
TWO people were there, each with their cousin.

No wait... even better:
Someone was their with their male cousin.
Someone was there with their female cousin.


How about this problem: What is the minimum number of points in a directed graph with twelve unique edges?

Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2982
    
    9
Here's one solution using 5:

A: a man
B: son of A
C: daughter of A
D: sister of A
E: son (or daughter) of C
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11145
    
  16

ok...4.

A Father with his daughter, sister, and nephew.



1. someone was there with their mother. son to mother
2. someone was there with their father. daughter to father
3. someone was there with their sister. father to mother
4. someone was there with their brother. mother to father
5. someone was there with their son. mother to son
6. someone was there with their daughter. father to daughter
7. someone was there with their aunt. daughter to her father's sister
8. someone was there with their uncle. son to mother's brother
9. someone was there with their neice. mother to brother's daughter
10. someone was there with their nephew. father to sister's son
11. someone was there with their cousin. son to daughter
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2982
    
    9
Ryan McGuire wrote:And yes, we're talking about traditional family trees. i.e. nothing like I'm My Own Grandpa.


I suppose All You Zombies is out as well, then.

So, no half-siblings, step-parents, incest, sex changes, hermaphrodites, or time travel, right?
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2982
    
    9
Dang, I had that same configuration, and then for some reason I forget (one of the conditions where I overlooked an already-existing relationship), I added a sibling (C). D'oh!
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

Ryan McGuire wrote:
But we all know that titar have an overly developed "personal" protection drive, bordering on paranoia, when just one other titar is present. Therefore, any time only two titar are in close proximity to each other it usually results in a frenetic battle to the death. This would result in a puzzler more like, "Titar triumphantly on top of Titar; Titar bleeding to death under Titar; How many Titar in all?" The only time there can be multiple (live) titar in a small area is when there is three or more, thus making Salvin's answer of three quite correct indeed.



?? ???
WOW...


actually its my fault, a bit of mistranslation caused 3 to become 2...

here is the translation with the omitted word highlighted:

There is a Titar in front of a Titar
There is a Titar behind a Titar
A Titar in front AND A
Titar behind,
How many Titar in all ?


actually even that looks like two but its 3 if the third sentence was said by a Titar in First person ...
given that in the realm of the fairy tale world birds are able to speak and express their opinions.
Muhammad usman shad
Ranch Hand

Joined: Jan 06, 2010
Posts: 30

I once jumped into the river but i did not get wet...
Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 459
    
    1
I got 3.


Vinod Tiwari | Twitter
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 2982
    
    9
Vinod Tiwari wrote:I got 3.

Three weighings? Three titars? Three family members? Which post are you replying to?
Milton Ochoa
Ranch Hand

Joined: Oct 23, 2007
Posts: 336

Mike Simmons wrote:
salvin francis wrote:
Ryan McGuire wrote:
salvin francis wrote:
There is a Titar in front of a Titar
There is a Titar behind a Titar
Titar in front,
Titar behind,
How many Titar in all ?


Let's see... I drew a diagram of the scenario described. I have a row of 15 titars side-by-side. In front of the fifth one is one more titar, so...
16. Final answer.


Answer = 3

[Titar][Titar][Titar]


Two seems sufficient.


I agree with you
Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 459
    
    1
How you got 2?
Milton Ochoa
Ranch Hand

Joined: Oct 23, 2007
Posts: 336

Vinod Tiwari wrote:How you got 2?


yes
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

let me clarify the results:

2's Explaination:

[Titar A][Titar B]

There is a Titar in front of a Titar === >> B to A
There is a Titar behind a Titar === >> A to B
A Titar in front and a, === >> B to A
Titar behind, === >> A to B


now for the 3's explaination:

[Titar A][Titar B][Titar C]

There is a Titar in front of a Titar === >> B to A or C to B
There is a Titar behind a Titar === >> A to B or B to C
A Titar in front and a, === >> C to B [considering Titar B is muttering this statement]
Titar behind, === >> A to B

rather Titar B is Saying:
There is one Titar in front of me and another behind me.


Tushar Bhaware
Ranch Hand

Joined: Aug 13, 2012
Posts: 62

I have only one rule that i don't have any rule.

So do i have any rule?


Remember you have not inherited earth from your ancestor,you only borrowed it from your descendants.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Yes, you do. You have one rule. And you're violating it, which you can't avoid.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Post your favorite trick questions
 
Similar Threads
Facebook Applications - Got a favorite?
fruit problem
Paradoxes and Ironies!!!!
stringBuffer hashcode
Action class being called only once in ajax