Interview Post Mortem
By Rogerborg (Fri Mar 10, 2006 at 09:21:51 AM EST) interviews, stupid questions (all tags)

It was... meh.  I dunno, it seems very familiar.  Small company, cash rich, customer poor, CEO seems like a nice bloke, decent environment.  Pretty much the same as my current outfit three years ago, so I expect it'll end up as much the same pit of over-expanded apathy and red tape.

I don't know why I expected anything else really.  I kind of lost interest half way through the interview.  I guess the more experienced you get, the shorter the honeymoon period is, but I never expected it to turn into a dry hump half way through the first date.

I guess I'll see if I put them off with my answer to the "visualisation exercise".  I'm in a sunny park.  What do I see, and how do I feel?  "Blokes with swords.  Cross dressing women.  Pugilistic."

I've never played off two companies before, but I think this might be the time.  One go at bumping the offer from Potential Less Crap Corp, then see if Current Crap Corp will beat it, or head off to Potential Less Crap Corp and reset the Crap Clock a couple of years.

So, anyway.  There's this circular prison, right, with cells round the outside.  The cells are numbered from 1 to 100 and all start closed.  One day, the warden decides to run round all the cells and flip the state of the doors (to open).  Then he runs round again, and this time he flips every second door, starting with the second.  Then he goes round again, and flips every third door, starting with the third, and so on, and so forth.

At any given circuit, how would you calculate whether a given door is open or not?  Also, after a given circuit, how many doors are open?  Show your working calculations.

Interview Post Mortem | 31 comments (31 topical, 0 hidden) | Trackback
less than optimal answer by DesiredUsername (4.00 / 1) #1 Fri Mar 10, 2006 at 09:43:21 AM EST
Every door is numbered. Every number has 2 or more factors (counting 1 and N as factors for prime numbers). At the end of all the circuits, all numbers with an even number of factors will be off because every on flip has an off flip. In order to have an odd number of factors, a number has to have some repeated factor, i.e. it "resuses" itself, i.e. the number is a perfect square. But you don't care about at the end of time, you want to know after a given circuit. So I guess what I'd do is get the factors of the given door and see how many factors I'd "passed" up until this circuit. For instance, door 10 and circuit 4. The factors of 10 are 1, 2, 5 and 10. 4 is greater than two of those, therefore I've flipped door 10 twice and it is off.

---
Now accepting suggestions for a new sigline
That's what I went with by Rogerborg (2.00 / 0) #7 Fri Mar 10, 2006 at 01:28:11 PM EST
Of course, I had to draw lots of little X's and O's before I saw the pattern, and then I carved a wheel and an inclined plane from the ceiling tiles.

-
Metus amatores matrum compescit, non clementia.
[ Parent ]
IAWTP by DesiredUsername (4.00 / 1) #13 Fri Mar 10, 2006 at 02:53:44 PM EST
I had to draw 20 doors, with hinges and handles and everything, on the whiteboard and do the counting to figure this out.

---
Now accepting suggestions for a new sigline
[ Parent ]
What was your warden wearing? by Rogerborg (2.00 / 0) #17 Sat Mar 11, 2006 at 12:58:01 AM EST
I went with a nice stocking-and-suspender combo.

-
Metus amatores matrum compescit, non clementia.
[ Parent ]
Spacesuit by DesiredUsername (4.00 / 1) #21 Sat Mar 11, 2006 at 01:40:42 AM EST
I didn't have much choice, it was a Lego minifig. Also, the prison walls kind of blocked the door for a while, so I got a Reprimand from the Fire Marshall. But it was worth it!

---
Now accepting suggestions for a new sigline
[ Parent ]
You have a LEGO fire warden? by ambrosen (2.00 / 0) #31 Sun Mar 12, 2006 at 09:03:04 AM EST

[ Parent ]
Simulation by ucblockhead (2.00 / 0) #2 Fri Mar 10, 2006 at 10:15:28 AM EST
Since you didn't specify "optimal", I'd simply write a simulation that run through N circuits.

As an AJAX application using a two-tier architecture and SOAP as a transmission protocol. And I'd drag someone else to my desk to use Extreme Progamming methods.

There's probably some "math" thing having to do with the fact that this is just the Sieve of Erosthenes.
---

oh wait by ucblockhead (2.00 / 0) #3 Fri Mar 10, 2006 at 10:16:10 AM EST
---
[ Parent ]
Play with them, by calla (4.00 / 1) #4 Fri Mar 10, 2006 at 10:28:30 AM EST
those corporate types love it.

"Current Crap Corp gave me these bon bons, you'll give me bon bons if you love me, Potential Less Crap Corp"

or

"Potential Less Crap Corp has a really big one. Current Crap Corp, you need to try harder."

You're the one good at this kind of stuff - why am I telling you how to play it?

Because you can't help yourself? by Rogerborg (4.00 / 1) #9 Fri Mar 10, 2006 at 01:32:06 PM EST
Now that you've fixed your life, you're missing the DRAMA.

-
Metus amatores matrum compescit, non clementia.
[ Parent ]
I am not into drama. by calla (4.00 / 1) #16 Fri Mar 10, 2006 at 03:34:19 PM EST
I like the quiet life.

[ Parent ]
Uh. by NoMoreNicksLeft (4.00 / 1) #5 Fri Mar 10, 2006 at 11:59:25 AM EST
Seems related to primes. But can't make much of it past that.
--
Do not look directly into laser with remaining good eye.
It is by Rogerborg (2.00 / 0) #18 Sat Mar 11, 2006 at 12:58:46 AM EST
It about odd and even factors.

-
Metus amatores matrum compescit, non clementia.
[ Parent ]
use a lookup table by dr k (4.00 / 1) #6 Fri Mar 10, 2006 at 01:20:21 PM EST
100 doors x 100 steps = 10,000 bits of data or 1250 bytes. You put this table on a microcontroller and build a middleweight class flipper battlebot around it, and I guarantee you will win the regional qualifier.

:| :| :| :| :|

I like that by Rogerborg (2.00 / 0) #8 Fri Mar 10, 2006 at 01:29:49 PM EST
I may call them on Monday and scream "LOOKUP TABLE" for a few minutes, just to cover my bases.

-
Metus amatores matrum compescit, non clementia.
[ Parent ]
it doesn't scale by martingale (2.00 / 0) #11 Fri Mar 10, 2006 at 01:59:53 PM EST
Suppose the warden is an athlete and there are 524 289 doors. Now that's all very well and good, everybody likes an olympian, but you only have 64K of memory to play with. Yes, this is 1981.
--
$E(X_t|F_s) = X_s,\quad t > s$
[ Parent ]
oh, so now it's a hypothetical puzzle by dr k (4.00 / 2) #14 Fri Mar 10, 2006 at 03:03:03 PM EST
No problem. I just get in my time machine and bring back VLSI technology from the future. While I'm in the future, I check my tax records to see if I got the job.

:| :| :| :| :|

[ Parent ]
grab me by martingale (2.00 / 2) #15 Fri Mar 10, 2006 at 03:20:46 PM EST
a croissant from the patisserie while you're there. I've always wondered whether they'd be fresher if they were served before they are made.
--
$E(X_t|F_s) = X_s,\quad t > s$
[ Parent ]
Quick, tell Breaker. by ambrosen (4.00 / 2) #19 Sat Mar 11, 2006 at 01:11:10 AM EST
We only need one employee to look after half a million people. That should sort out his benefit worries.

[ Parent ]
only if you answer me this by martingale (2.00 / 0) #20 Sat Mar 11, 2006 at 01:26:57 AM EST
You have three light switches, each connected to a different lightbulb down in the wine cellar. You don't know which one turns on which one. Determine what switch goes with what bulb by going down to the cellar at most once. (if you go a second time you'll be eaten by a werewolf).
--
$E(X_t|F_s) = X_s,\quad t > s$
[ Parent ]
Well, by ambrosen (2.00 / 0) #22 Sat Mar 11, 2006 at 03:20:33 AM EST
Warm Bulb

That said, I simply can't get into the character, darling. What's my motive?

[ Parent ]
it's the usual by martingale (2.00 / 0) #23 Sat Mar 11, 2006 at 04:35:58 AM EST
Reheated puzzles from bored interviewers who'd rather read a dupe on slashdot and hr people who think all geeks are the same anyway. You play the manic depressive character who just can't get into the mood for smalltalk, but gets all excited over a puzzle, as long as it's _new_.

Make sure you get the wardrobe girl to give you the washed out jeans outfit as your character isn't supposed to be well off.
--
$E(X_t|F_s) = X_s,\quad t > s$

[ Parent ]
I'm so in subject for that. by ambrosen (2.00 / 0) #24 Sat Mar 11, 2006 at 06:56:33 AM EST
Just call me Dustin Hoffman.

[ Parent ]
Hmmm. by crux (4.00 / 1) #10 Fri Mar 10, 2006 at 01:35:40 PM EST
An intellectually lazy attempt at the puzzle:

For X rounds, door N is open if:
openDoor(K,N) = (sum(k=1..X) ( (N mod k == 0 ? 1 : 0) ) ) mod 2 == 1

A cheap and dirty way to get the number of open doors:
numberOpen(K) = sum(n=1..100) openDoor(K,n)

I'm reasonably sure there are some fancy identities that I don't know that allow both of those to be reduced to non-iterative formulae, but beats me.

Answer: by DullTrev (4.00 / 10) #12 Fri Mar 10, 2006 at 02:44:22 PM EST

Who cares? The prisoners all legged it during the first circuit.

And that, my friend, is why you programmer types need project managers like me. To see to the heart of the problem.

Now get back to work, you slacker.

--
DFJ?
Not to mention, by ambrosen (4.00 / 1) #25 Sat Mar 11, 2006 at 09:51:26 AM EST
to fail to ensure that the fences are fully in order.

Idiot.

The suits are such lU5erz!!! Only pragrammers are 1337.

[ Parent ]
So? by DullTrev (4.00 / 1) #26 Sat Mar 11, 2006 at 11:00:13 AM EST

The prisoners are now holding the warden captive...

--
DFJ?
[ Parent ]
Right? by ambrosen (4.00 / 1) #27 Sat Mar 11, 2006 at 01:58:45 PM EST
I don't think they can run as fast as super warder, can they?

[ Parent ]
They don't need to by Cloaked User (4.00 / 1) #30 Sun Mar 12, 2006 at 08:47:50 AM EST
It's circular; they have him surrounded.

--
This is not a psychotic episode. It is a cleansing moment of clarity.
[ Parent ]
Prison by nebbish (4.00 / 1) #28 Sat Mar 11, 2006 at 07:07:56 PM EST
Life sentence - leg it
Long sentence - weigh it up
Short sentence - grass

Am I missing something?

--------