Skip to content
Related Articles

Related Articles

Improve Article

Microsoft Interview | Set 23

  • Difficulty Level : Medium
  • Last Updated : 15 Jul, 2021

Written Test: First round was an online test on cocubes platform (not good for coding). This test is based on C, C++ and DS. The shortlisted students in this round were selected for next round which is coding round. Coding round had two questions: 

 

  1. In a Tic-Tac-Toe game two players are playing where player 0 is denoted as 0 and player 1 is denoted as 1. Given a linked list of moves made by the players ,determine who is the winner and in how many moves he required for winning. 
     
    Struct Move {
       int p;    //Player number
       int x;    //x and y pos in the tic-tac-toi
       int y;
      struct Move *next;
    };

    Solution: GeeksforGeeks Link

  2. Given an array if in a position let a[i][j] =1 then print all itโ€™s row and column 1. You should not consider a position 1 after you made it 1 in your past computation. 
    Note: In this question it is asked to not use any extra space. 
     
    sample(input):
    (i) 00100            (ii)10
        00000                01
    output:
    (i) 11111            (ii)11
        00100                11

Group Fly/Activity: 
 

  1. Check if a binary tree is balanced or not.
  2. remove duplicates from a string inplace.

 

Interview Round-1: 
 



  1. Interviewer asked me to optimize the code for the question 2 in previous round (Not in terms of complexity but in terms of number of assembly instructions, time taken to execute each instruction)
  2. Some simple questions based on LL. Sorry I couldnt recollect ๐Ÿ™
  3. Recognize power of two using bit operations

Interview Round-2: 
 

  1. A node which has following fields 
     
      a) data
      b) next_ptr
      c) prev_ptr

    can be used to represent doubly linked list, binary tree or none. Given a random pointer recognize whether it forms DLL, Binary Tree or none. I pointed out that for Binary tree root node has to be given then he asked me to assume the same.

 

Interview Round-3: 
 

  1. 2 numbers each reperesented by linked lists, write a function which  gives difference of these numbers.
  2. Consider a webpage which has a big single image and another page in which the previous image is divided into 6 parts, which one loads faster? 
    Now propose a solution reducing the loading time.(There are no bounds for this question to think, I proposed a solution which includes concepts from vision, networks and multimedia. The interviewer was very much impressed and immediately told me that I am going to have a next round)

Interview Round-4: 
 

  1. Copy a linked list with next and arbit pointer.
    I told him that I knew this question, then he asked me for the approach and test cases and moved to the next question.
  2. Given two sorted arrays. Second array has enough extra space to accommodate elements in first array. Give the resulting sorted array obtained by merging two arrays without using extra space.
  3. Consider a binary tree for which root node and a target node are given to you. Give the next sibling of the target.(let the target be in level k, then you need to give the immediate node which is in level k)
  4. Other questions were based on arrays, linked lists and binary trees (mixture of these).

All the interviewers were very cool, helpful etc etc… They understand our tension and try to make us feel as comfortable as possible. The first interviewer even put his arm over my shoulder during our little walk from canteen to interview room. 

And yes hired!!! Thanks to GFG. 

Many Many congratulations to the author. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to review-team@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks. 

 

 

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon. GoogleE-Litmus and Microsoft Test Serieses.

My Personal Notes arrow_drop_up
Recommended Articles
Page :