Wednesday, December 5, 2012

Lessons learned from an interview with Microsoft

Three steaks in three nights. Medium-well, medium, and medium. I'll name them Hopeful, Rejected, and Consoled. The names describe the gamut of emotions I felt last weekend. I'm normally an emotionally stable individual but job interviews with anyone tend to psyche me out. Such was the case with my interview for an SDE (Software Development Engineer) Internship with Microsoft's Windows team.

Five interviews, actually. The first one was reminiscent of the interview for my entry-level web development job. It was fairly easy, I hardly had to sell myself, and the technical question was almost trivial. That interview took place in my university's career center. It's just a trial run to see if I was at least somewhat competent. The next four, however, took place at Microsoft's campus in the heart of Redmond, Washington. And what a treat the whole thing is! They pay for round-trip flights, two nights at the Westin, a rental car for the duration of the trip, $75 per day for fine dining (which explains the steaks), and a few other treats. If you've got one of these coming up, I would highly suggest working through these problems, finding a good answer, and seeing if you can find a better one. Each interview lasts 45 minutes so you've got to think quick.

First was kind of a tricky math problem. I was given an array of integers of length n. The values stored in the array were restricted to values from 1 to n-1, inclusive. My task was to come up with a way to find the first duplicate value in the array. A brain dead solution is easy, but can you come up with an algorithm that runs in linear time and does not use a secondary array?

The next one dealt with an interesting linked list. You're given a singly-linked list. Each node actually has two links to a 'next' node, link1 and link2. The two links in a node will not necessarily point to the same node. Think of it as a list of people. One set of links could be the list sorted by height. The other set of links could represent the list sorted by age. The task is to reverse the order of one set of links while preserving the order of the other. (I assume there was more to this problem, but I didn't get very far on the first part so I never heard the second part). Here's a visual for clarification:

Link1 path: A--->B--->C--->D
Link2 path: A--->C--->B--->D


The third one was very similar to the second (thankfully). You have an n-ary tree (a tree where each node has 0 or more child nodes). The tree is stored as a type of linked list. Each node has two links: one to the next 'sibling' node and one to the first child node. My task was to reverse the order of sibling nodes while preserving the parent-child relationship. For example, if you have this tree:

A
|
B------------->C
|              |
D--->E--->F    H--->I

After reversing the order of the siblings, you'd have:

A
|
C-------->B
|         |
I--->H    F--->E--->D

Notice that in the first tree, B's first child is D, but in the second tree, its first child is F. Since we had a few minutes left after I gave a working solution, my interviewer then asked me to write another function which prints out the contents of the tree in order.


The fourth and final one was fairly straightforward. I was given a binary search tree that contains ints. Remember that a binary search tree is one where each node has 0, 1, or 2 child nodes and that the left child (and all of its descendants) has a value that is less than the node and the right child (and all of its descendants) has a value that is greater than the node. I was supposed to determine whether a given binary tree was valid.

I wanted to share these questions with you, not so you can have an unfair advantage (which is why I didn't include any hints), but so that you can know what types of questions to prepare for. Be prepared to come up with a quick solution, make sure it works, then to optimize it as best you can. This was actually my second time going through the whole Microsoft interview process and these questions were fairly similar to those in my first round. I can't speak for all interviews since I only ever interviewed with the Windows team, but I would imagine that questions of the same difficulty would be asked in any SDE interview.

To be fair, I should include other questions they asked me that were of a more personal nature (these aren't word-for-word).

  • Why do you want to work at Microsoft?
  • What are the most important factors for you when considering a job?
  • What has been the most challenging problem/bug you've dealt with in any of your projects at school or work? How did you solve that problem? Be specific!
  • Have you ever had to convince someone else to use your plan/approach/strategy/solution over theirs? How did you do that?
  • Do you enjoy writing code? Why?
  • Do you like debugging?
  • What are some personal projects outside of school or work that you've been involved in?
  • What's been your favorite class in your college career so far? Why?
  • Least favorite class? Why?

Tuesday, December 4, 2012

Motivation for proper ethics

Anger is a great motivator. Look at almost any video on Youtube and you'll see trolling and put-downs sprinkled amidst a few relevant comments. Couple that with the anonymity of the Internet and people who are otherwise quite friendly say some downright offensive things. However, if you give someone a good reason to do something -- a reason that both offers them success and lets them feel like they've helped out the world in some way -- they will generally do good things. All too often ethics and morals are branded as archaic or old-fashioned. No one who needs to stay afloat in a world that is constantly flooded with new technology wants to be considered old-fashioned. But if you convince people that following a code of ethics will actually benefit them more than following a selfish code of conduct, they will do the right things -- the ethical things -- all on their own. It's a matter of motivation.

Monday, November 26, 2012

Too much gaming

I lived with a gamer once. He spent most of his time hunched over his computer in his dimly-lit room. At night, he would continue playing, only stopping to use the bathroom and eat a frozen burrito or some cold cereal. Now and again, he would burst out in uncontrollable laughter, sometimes in the middle of the night. He chose to socialize virtually in his MMORPG rather than verbally with his roommates. The rest of us would occasionally invite him to go out and do things but he would politely decline. His hygiene had crumbled into ruin to the point where we could tell he'd walked in the room just by inhaling. To this day I regret that there wasn't a more concerted effort to encourage him to change. How does this happen to a 6'8" 18-year-old football player? Gaming was for him, as it is for many, a serious addiction in every sense of the word. It can start off as a healthy way to blow off some steam or spend time with friends. In rare but gradually more frequent cases, real life becomes a mere side effect of being alive; the game is where one's new life continues. Games are not inherently bad but severely skewed priorities are.

Thursday, November 15, 2012

What's in store for family history?

Huge advances were made with family history in the 1980's and 1990's with the advent of personal computers. Although the physical copies of past family history work have their own intrinsic value, their purpose was better carried out by the digital revolution. In the late 2000's, the next innovation was FamilySearch Indexing, which was far more inspiring to those without a desire or time to compile a complete family history. Indexing names taps into the power of crowd-sourcing but, more importantly, it helps relieve a healthy amount of guilt from members of the LDS Church (myself included) who had yet to do any family history. What's next for this field? We've only just scratched the surface.

Tuesday, November 13, 2012

How to get the word out

How do you get the word out? Social media is really the answer in most cases. Take the Orabrush, for example. This ordinary oral hygiene tool with no real glamour has become a household name. Originally its owner considered sending it to the graveyard of advertising: the infomercial. This uninspiring, overenthusiastic and underwhelming format has doomed many great products. Instead of mercilessly beating his cherished invention, he took it to a group of marketing students at Brigham Young University. They leveraged the power of today's great social media sites, Youtube.com, and advertised it as a no-brainer product for young adults. The clever part is that they made something that people not only want to watch, but that they want to share. The rest is history. Once you tug on the world's heart strings or tickle its funny bone, you'll be able to get the word out.

Wednesday, October 31, 2012

What if indexing could be done by a computer?

This is a question that I've asked myself on a number of occasions. While I do believe that one feels a real sense of accomplishment after finishing another batch of names and that many who participate feel the Spirit of Elijah as they participate in this work, that's not the reason why indexing is still done by humans. The advent of computing has immensely streamlined many of the operations of the Church. Computers have saved countless hours, tons of paper, and millions of dollars. I'm sure that members of the Church before computers felt blessed to perform service by carrying out these sometimes tedious tasks, but that didn't stop the Church from replacing this service with a computer program. That same person can now bless the lives of others with the technology that took his previous service opportunity from him. So why doesn't the same thing happen with indexing name for temple ordinances? To put it simply, computers don't read cursive (yet). I'm sure that when the day comes that they can, members around the world will bless the one who creates the technology and speeds up the work, not curse the one who denied members the opportunity to serve by indexing names.

Wednesday, October 24, 2012

Get with the program

The beauty of Capitalism is that businesses are rewarded for doing more for their customers. Let's say we have two companies, A and B. Company A has been around for 60 years. During that time, it developed a ground-breaking business model and a brand-new product that revolutionized the industry. It's now grown to become the largest company of its type and nearly dominates the market. Company B started up 3 years ago with the help of 3 employees, a good product, and social media for advertising. Both companies offer a product designed to solve the same problem. Both have their advantages and disadvantages. This is where capitalism shines. What if Company B suddenly takes a huge hold of the market? It doesn't make sense to Company A; B's prices are higher. A closer inspection reveals that B's product is slightly better, and they offer better service to customers. Is this fair? What if Company A loses its grip on the market and, as a result, is in danger of going out of business? After all, it's been around for 60 years. Shouldn't it stay around? The only way to revive Company A is to do more for their customers. If they don't, they lose. However, if they do, everybody wins. Not only is A revived and the customers pleased, but B will be forced to either lower their prices or create an even better product. This cycle will continue in a glorious self-correcting fashion. That's the beauty of Capitalism.