10 18 05 1526 W - + 2 - 2 The trenches

"Lo, and I have been to the promised land, they'll let me know if they want me back"

I wish I could say, "Man, I got pwned" or, "Man, I pwned", and you know, have some finality to the matter.  Alas, I did good, but not great.

The day started as a day like this should, with some Murphy's Law and a healthy dose of Panic.  Having left my white, clean interview pants at home in the fury of packing, and having left the lighter, not black, interviewy shirt at home, I was forced to show up in ripped jeans, the black shirt, and a leather jacket.  I looked kind of imposing, it was weird.

Also, taxis were backed up this morning.  I got there fine and all, but the hotel had trouble tracking me down for one, and all I could do was chug coffee and eat a small powerbreakfast at the buffet.  Scrambled eggs, potatoes, french toast, they have freakin' EVERYTHING.  However, I had a danish and some eggs, and a whole lotta coffee.

Arrived, played a little X-BOX in the waiting area (They're cool like that, these corporate types), and eventually met my recruiter.  Did the "getting to know you" interview, all the questions you get asked in a typical interview.  How do you approach challenges, what do you do to improve yourself as a dev, Why Microsoft, etc.

That part's easy.  Sincerity and enthusiasm, both of which I have.

"You have two interviews scheduled, at the Office building."

Jab-Uppercut.  Office apps are boring, complicated, and I try to avoid them as much as possible.  Only two isn't all that encouraging, either.

Nevertheless, I went.  For those of you smirking at the visual I painted in the last entry, my first interviewer's name was Igor.  I asked what it was he did, and he said, "You know the toolbars?  They're old and don't work anymore.  We're replacing them."

Woot, I thought.  Making the most complicated suite of software I've ever encountered in MY LIFE easier to use.  I'm on your team.
Didn't do too hot.  Didn't do bad, but I hit a stumbling block during one of the more complicated questions, and ran out of time.
    For those of you who code-  return true if an array of ints has dupes, false otherwise.  Assume all ints are between 0 and array.size - 1, inclusive
    Did you sort and check against the next one?  That's O(nlogn + n).  Make it O(n).
    Did you use an array/hashtable of counters?  Too much space.  Make it smaller.
    Keep it O(n).
    Wasn't quite able to make it smaller.  He wanted in-array traversal, in O(n), on an unsorted array.  Not destructive.

Second interview, lunch, talk about myself some more.  Friendly guy.  Then, inorder binary tree traversal in C.
Then, non-recursive in-order binary tree traversal in C.  Allowed to use data structures.
I tried to do it with a stack, was on the right track, ran out of time.  (Incidentally, and this is more directed at the coders-  You can't nest "go right" and "go left" while loops in a "not empty" while loop, because when you go up a node, you'll just go right back down the left.)

I think I still did okay with the first two, because I was able to articulate my various approaches, and I was able to come up with multiple ones and improve on them.  And when I hit a stumbling block, I talked through what I wanted to do and why I couldn't, and where I was stumbling.

Third guy, translation of modding and %ing (they're different, depending on the language.  WTF???) negative numbers.

I wailed it in two lines.  It was recursive, weird and original, gorgeous in it's elegance.
"What if it's -4005?" He said.
Then it would have to execute x/4005 times.  So I found a longer, but more staggeringly efficient way.
"That'll work for 7/8ths of all possible numbers," he said.
Special case.
"Can you make the code shorter?"
I looked at it and pointed at redundancies that had occurred from my modifications.
Then I started over below it.  Swapped the if/else for an if, changed "if this, return this.  else, muck around with it a bit, then return it" to
"if this, muck around.  Return result."

Next question-  Compression algorithm, change (5,5,5,5,25,25,17,0) to (4,5,2,25,1,17,0). I'm working inside byte arrays, and have a max length of the returned byte array.
I look at it, and realize everything I don't know.  Am I guaranteed numbers shorter than 256?  Are all the dupe numbers grouped together, and if not, am I responsible for handling that?  What if the 0 (termination char)doesn't fit in the max sized array, do I chop off the last data pair or not add the 0?  What if the max size is even, and there's only room for the count and the zero?

Question question question.  He'd pause and think.  I was playing a dangerous game.  Give him too many opportunities to make the problem harder, and he might.  Pretend not to notice the ambiguities of the question, and he might nail me with strange cases.  The last guy did.  This one, though, was all about not making it more complicated than it had to be.  "We can assume", he kept saying, and give me the simpler system to work with.

I kept  switching between coding mode and explanation mode.  It's bad if you just tap out for 5 minutes and scrawl like a madman, and expect the other guy to read it.  You have to talk through what the hell you're doing.  They have to see what the hell is going on in your head.

Wailed it (woot woot!), went downstairs, 10 minutes later, a friendly guy who's name I couldn't catch (strong accents, incidentally, make interviews harder, and somewhat frightening.  At one point I mistook "string" for "stream", and was paralyzed as to what to code), and whose job I haven't the foggiest other than it might be for shared ("the shaded team", he'd say) led me into another room for the final set.

First question-  Write atoi.
I drew an algorithm on the board, did some math, showed how I was going to handle it.  He said he actually wanted me to code it.  I grinned, told him I would, but I was just showing him what the code was going to be doing.  It helps, I found, to write out patterns, both to cement them in your head, and so someone else can follow your twisted little paths of logic.
He said oh, thank you, and I said no problem, and started coding.
Wailed it.  Not that it was hard, just it required that you look at it the right way.

Next question-  Given a Matrix of 1's and 0's, of size M * N, change every 1 in the same row or column as a 0 to an 0.  But don't use any of those new 0's as logic for changing other 1's.

First attempt-  Changed all the changable 1's to -1's in the first pass.  Changed all the -1's to 0's in the second.
They can only be 1 or 0, he said, not -1.
No problem, said I, and proceeded to build a new Matrix, filling it in with data based on the first.
Use less memory, said he.
No problem (internally:  WTF??????) said I.
Pause, think, pause, think.
Wouldn't quite say I wailed it, because the code was pretty long and had two sets of nested forloops.  That, and my naming convention was a little confusing (I blame this on the problem.  Honestly, I had to keep track of i,j,m,n,rows,cols, iArray.  For those of you playing the home game, 2 1D arrays, 1 2D array, two max sizes, and two placekeepers.  Not to mention treating a 2D array as a 1D array), and there was a bit of a language barrier.  Ever vigilant, thoroughly convinced that it was right (read:  Not sure at all, I can't track more than 4 variables manipulating eachother at a time, and there were 7, but I needed them all.  I felt like the guy in Memento), I stepped through it.  To my great (but hidden) surprise, it worked.

4 interviews in one day, all in the MS Office division.  Much more enthusiastic about the Office thing now that I have a description of what they actually do, and got a look at the logic side of the stuff they work on.

Really not too worried about whether or not I get the job.  Just, and I mean Holy Crap On A Goddamn Stick Batman, proud I made it through the day.

-Alex

Hey Just Some Guy – I’m super proud of you, and keeping fingers crossed that you make it to the next gate.
Fork - 10 19 05 - 00:16

Huzzah!
Jenny B. - 10 19 05 - 01:29

IDEA
a 2d array is an array of arrays.

-make an array N long. (TEMP)
-run through every array from 0 – M one time. (so we’ll call K our “current array in 0-M)
-replace every value of 1 with 0 in K AS IF there were a 0 down the line. record if you actually run into a 0
-at the end of a single pass through one of the arrays, if you ran into a 0, swap pointers in M K for TEMP, go to your next array

O(n) size O(n) runtime.
Andrew - 10 19 05 - 11:15

PS. well done.
Andrew - 10 19 05 - 11:15

Would work, EXCEPT- Wasn’t a real 2D array, it was actually a 1D array of size M * N. M and N were tossed in as parameters.
However, the conversation we had a while ago about how to translate 2D coordinates into a 1D placemarker saved my butt, I wrote a helper function up on the board and make the code cleaner, and not have to think about it too hard.

PS- Thanks:P
Alex () (URL) - 10 20 05 - 12:40

So what if a node took the resemblance of an isotope 1# and then went into an integral of pi87*64 with an integer of 5^3? Then you could take the stream of x5 and have it be reinterpreted at a geometric rate of 0.783, then you wouldn’t have that same error message on the third line. See, I can talk gibberish too. :) I got some news about the move, call me.
Zeke () - 10 24 05 - 05:08


  
Remember personal info?

Emoticons / Textile

  ( Register your username / Log in )

Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.

Fatal error: Call to undefined function: load_user() in /homepages/33/d92781182/htdocs/journal/pivot/pvlib.php on line 3274