Preparing for the Coding Interview

I recently got interviewed for a position at Microsoft and I think I owe acknowledgement to the various interview resources I used to prepare for it. Further, it should be helpful to many others like me who will be facing technical interviews this interview season.

8 thoughts on “Preparing for the Coding Interview

    • I had 3 interviews. First two were purely technical and third was part HR.

      In the first interview, the interviewer asked me to write code to reverse a singly linked list. It later turned out that he wanted the code to handle circular linked lists as well. The second question was to design a caching system for URL->IP address mapping which can be installed in routers (in-memory data structures and swapping system with disk).

      In the second interview, first question was on the coin-change problem and second question was on detecting cycles while adding a soft-link in Unix file system (basically cycle detection in graphs).

      The third interview was part HR, part technical and included questions on my interests, the courses I had taken, questions on those courses, data pipeline in Bing (where I worked), and other common HR questions.

    • Most questions were on linked lists and binary trees. Right now, I remember these questions:

      • Build a stack that supports operations on the middle element
      • Non-recursive Tree traversals
      • Morris Traversal
      • In a matrix where each row contains some number of 0’s followed by all 1’s, find the row having maximum number of 1’s
      • Find the probability of a knight to remain on a chessboard after N moves
      • Finding the number of rotations in a rotated sorted array
      • Designing the sizeof operator
      • Finding intersection point of two linked lists
      • Finding LCA of two nodes in a BT, with and without parent pointers, and in a BST
      • Interleaving two linked lists into one, iteratively and recursively
      • Implementing an unbounded-capacity stack, discussing trade-offs b/w resizable array and linked list and combining the two approaches
      • Implementing a hash-table, discussion on different approaches, trade-offs and hash functions
  1. need some assistance over here…

    Given a room with points pertaining to different groups, check whether the connection is planar or non­planar i.e. while connecting all the points in the same group, the wires of different groups should not overlap.

  2. Hello kartik sir,I am following you and your post for last 1 year and so and I am in love with you blog.I am in 4th year of my B.E(just passed third).I have 2(or maybe 3) questions please guide me.

    Q1) Sir,I am not from a very good college(state gvt college) and don’t have very high cg.I have 7 cgpa.But I am very clear with all the dsa concept and can answer almost every question you mentioned above(and many more,I have been preparing for long time).Can I still get placed in giants like MS.
    Q2) Along with DSA and ALGO.I have also started Data Analytics.Will that help me in my interviews with MS.
    Q3) What else should I study except above three. So that I can say myself well prepared for the interview ?

    • I don’t think college is a big factor for top companies like Google, Fb, Microsoft. The interview bar may be higher for you but that’s understandable. It’s good that you have picked a field of interest (Data Analytics). It shows the company that you are genuinely interested.

      For interview preparation, I’ll suggest interviewbit, cracking the coding interview and hiredintech (especially their system design track). System design is a difficult part, although it doesn’t have as much weightage for freshers, but it wouldn’t hurt to learn about it.

      If you need referral to Microsoft, please do get in touch. Thanks for reading the blog.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s