d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Fun Interview Question > For A Software Engineer Job
123Next
Add Reply New Topic New Poll
Member
Posts: 14,631
Joined: Sep 14 2006
Gold: 575.56
Mar 15 2016 03:39pm
So, I had an interview today for a programmer position, had a test/evaluation thing to take bitwise operators, binary/hex math, logic operators, pl stuff, database implementation all the stuff you would expect if they were gonna give you a test to be a programmer.

at the very end of the test there was a fun question

Bob has 3 daughters a house with a porch and a fenced in yard. Bob has his friend Tom over one day. Tom asks Bob "how old are your daughters now Bob?" Bob replys "the product of their ages is 36, the sum is the same as my address." Tom thinks it over and says "Bob I need more information." Bob pauses for a moment and says "your right, my oldest daughter has brown hair."

How old are bobs daughters?

This post was edited by Ideophobe on Mar 15 2016 03:40pm
Member
Posts: 3,476
Joined: Jul 20 2015
Gold: 651.00
Mar 15 2016 04:48pm
How can one answer that question without knowing the address?
Member
Posts: 14,631
Joined: Sep 14 2006
Gold: 575.56
Mar 15 2016 04:56pm
Quote (spt_94 @ Mar 15 2016 04:48pm)
How can one answer that question without knowing the address?


i answered it

hint - tom did know the address

This post was edited by Ideophobe on Mar 15 2016 04:57pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 15 2016 05:00pm
It's a fairly common problem. Saw it in high school
Member
Posts: 14,631
Joined: Sep 14 2006
Gold: 575.56
Mar 15 2016 05:04pm
Quote (carteblanche @ Mar 15 2016 05:00pm)
It's a fairly common problem. Saw it in high school


o? i'ld never seen it before (*waiting on answer*)
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Mar 15 2016 05:40pm
A real programming question is the superstar question.

A super star is someone who everyone knows but knows noone. Of a group of n people describe the fastest way to find the superstar.

Only way I thought of so far is solvable in O(n^2) but apparently it's solvable in O(n).
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 15 2016 05:49pm
Quote (AbDuCt @ Mar 15 2016 06:40pm)
A real programming question is the superstar question.

A super star is someone who everyone knows but knows noone. Of a group of n people describe the fastest way to find the superstar.

Only way I thought of so far is solvable in O(n^2) but apparently it's solvable in O(n).


using n-1 bullets and good aim, you can pick your own superstar in O(n).

i'll think about how to solve it if you forget your gun at home.

This post was edited by carteblanche on Mar 15 2016 05:59pm
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Mar 15 2016 06:04pm
Quote (carteblanche @ Mar 15 2016 07:49pm)
using n-1 bullets and good aim, you can pick your own superstar in O(n).

i'll think about how to solve it if you forget your gun at home.


Pretty sure if you answered that they would think you a psychopath waiting to shoot up your work place.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Mar 15 2016 06:13pm
Quote (AbDuCt @ Mar 15 2016 07:04pm)
Pretty sure if you answered that they would think you a psychopath waiting to shoot up your work place.


hm. is it as simple as finding the first person who knows nobody? there can't be a second person because one of them must know the other. go to each person and ask "do you know anyone?" or can you only ask person p if he knows p_k where p_k is a specific person? so you'd have to ask "do you know p_1? do you know p_2?"

This post was edited by carteblanche on Mar 15 2016 06:15pm
Member
Posts: 13,425
Joined: Sep 29 2007
Gold: 0.00
Warn: 20%
Mar 15 2016 06:22pm
Quote (carteblanche @ Mar 15 2016 08:13pm)
hm. is it as simple as finding the first person who knows nobody? there can't be a second person because one of them must know the other. go to each person and ask "do you know anyone?" or can you only ask person p if he knows p_k where p_k is a specific person? so you'd have to ask "do you know p_1? do you know p_2?"


I thought that as well. The catch that screwed with me is everyone must know the superstar. So even if a person knows no one, everyone must know that person.

Edit:: This was a question from a Microsoft interview a friend had.

This post was edited by AbDuCt on Mar 15 2016 06:23pm
Go Back To Programming & Development Topic List
123Next
Add Reply New Topic New Poll