- Published on
Microsoft | L61 | Hyderabad | 12 July [Waiting]
- Author
- Shared Anonymously
Background
YOE : 4 Years
Current company : FAANG
I applied several times through referrals but received only automated rejection emails. Then, in June, I randomly applied to multiple suitable positions via the career portal and received the online assessment link.
Online assesment on Codility [26 June]
3 Questions needed to be solved in 120 minutes.
[First question]
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. Don't remember the exact code snippet but the solution was to replace one if
keyword with while
keyword.
[Second question]
Leetcode Easy question. Don't remember the question.
[Third question]
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, 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 liter, the driver chooses the one labeled with the smallest letter.Calculate 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
1. First Round (DSA) [12 July]
[First question]
Given a circular array A that only contains 0,1
. You have to find number of alternating subarray 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
[Second question]
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
2. Second Round (DSA + HLD) [12 July]
[First question]
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.
[Second question]
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
3. Third Round (HLD) [12 July]
Some questions related to my role and work in my current company.
[First question]
Design a Star rating system like in amazon.
Self Rating : Hire
4. AA Round (Behavioural + DSA) [16 July]
Behavioural questions like -
1. Why Microsoft?
2. Tell me about a time when you had faced a challenging problem and how did you solve it?
3. Questions related to my resume.
[First question]
49. Group Anagrams
Self Rating : Strong hire