Panda Guru LogoPanda
Guru

Microsoft | L61 | Hyderabad | 12 July [Reject]

Online Assessment on Codility

Questions:

  1. A code snippet was given where it was not producing correct output for all the inputs. At max 2 lines can be modified of that snippet. I had to debug and fix the code. The solution was to replace one if keyword with while keyword.

  2. Specific question not provided.

  3. There is a queue of N cars waiting at the filling station. 3 fuel dispensers, x, y, z. When a car arrives at front of the queue, the driver can choose to go to any dispenser not occupied. If all unoccupied dispensers have less than required by the driver, he has to wait. If more than one dispenser has the required liters, the driver chooses the one labeled with the smallest letter. Calculate the max amount of waiting time. If all the cars cannot be refueled, then return -1.

    Assume taking one liter of fuel takes exactly one second. Example: A[2,8,4,3,2], x= 7, y=11, z=3, then cars will be waiting 0, 0, 2, 2, 8 seconds. So the max waiting time is 8 from [0,0,2,2,8] in this example.

    Reasoning:

    let 'w' = wait time A[0] = 2 --> goes to x. w += 0; fuel remaining at x = 7 - 2 = 5 -> had to wait 0 seconds A[1] = 8 --> goes to y. w += 0; fuel remaining at y = 11 - 8 = 3 -> had to wait 0 seconds A[2] = 4 --> can't go to z (only 3 liters of fuel) so wait till 'x' is available; w += 2; fuel remaining at x = 5 - 4 = 1 -> had to wait 2 seconds because of A[0]. A[3] = 3 --> goes to z. w += 0. fuel remaining at z = 3 - 3 = 0 -> has to wait 2 seconds because of A[2] had to wait 2 seconds. A[4] = 2 --> can't go to x and z (not enough fuel) so wait till 'y' is available; so is wait time += 8 now? fuel remaining at y = 3 - 2= 1 -> Had to wait 8 seconds

    Solved the above problem using PriorityQueue. Solution link: Q3 Solution

Candidate's Approach

The candidate debugged the first question by modifying the code snippet as required. For the third question, they implemented a solution using a PriorityQueue to manage the waiting times of the cars at the fuel dispensers.

Interviewer's Feedback

No feedback provided.


First Round (DSA)

Questions:

  1. Given a circular array A that only contains 0,1. You have to find the number of alternating subarrays of size K. For example, If A= [0,1,0,0,1,0,1] and K=3 then the answer will be 5 and the subarrays will be:

    • [0,1,0] -> index 0 to 2
    • [0,1,0] -> index 3 to 5
    • [1,0,1] -> index 4 to 6
    • [0,1,0] -> index 5 to 1 -> because it's a circular array
    • [1,0,1] -> index 6 to 2 -> because it's a circular array
  2. 3. Longest Substring Without Repeating Characters

For both of the questions, I solved using sliding window. I was asked to come up with only the approach, time and space complexity for the second question.

Self Rating: Strong hire

Candidate's Approach

The candidate utilized the sliding window technique to solve both questions, focusing on the approach and complexities for the second question.

Interviewer's Feedback

No feedback provided.


Second Round (DSA + HLD)

Questions:

  1. 93. Restore IP Addresses I had to execute the code on Codility and verify it using the inputs provided by the interviewer. Additionally, the interviewer asked for suggestions on how to improve the code's performance.

  2. Design a chat application like WhatsApp. I had a great start on the design question but I wasn’t able to solve some of the questions asked by the interviewer due to time.

Self Rating: Lean no hire

Candidate's Approach

The candidate executed the code for the first question on Codility and discussed performance improvements. They started well on the design question but struggled to complete it in the allotted time.

Interviewer's Feedback

No feedback provided.


Third Round (HLD)

Questions: Some questions related to my role and work in my current company.

  1. Design a Star rating system like in Amazon.

Self Rating: Hire

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.


AA Round (Behavioural + DSA)

Questions:

  1. Why Microsoft?
  2. Tell me about a time when you faced a challenging problem and how did you solve it?
  3. Questions related to my resume.
  4. 49. Group Anagrams

Self Rating: Strong hire

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.


Update
Got automated rejection on 2 August. They haven’t provided any feedback on why I was rejected. My guess is that the 2nd onsite round contributed to the rejection. Looks like I need to do better.