Microsoft | SDE 2 (62) | Bangalore | July 2022 [Offer]
Status: Total 7 years of experience
Position: MTS 4 at a product based company
Location: Bengaluru, India
Date: July 2022
Overall Process:
Rounds
Online Assessment
The test was for 70 mins for me. I had to complete 2 questions.
Q1: There are houses situated in a row and there are garbage trucks which visit these houses. Each truck can take only 1 type of garbge. There are total 3 trucks (one each for Wet, Dry and Recycle waste). Each truck takes 1 unit of time to travel between houses as well as from start position to 1st house. Each house puts out different number of garbage bags. The time to load 1 garbage bag in the truck is also 1 unit. Each truck will only visit a house if there is a garbage bag of that type put out by the house.
Find the minimum amount of time taken by the trucks to collect all the garbage bags and come back to initial position.
Ex:
1// The garbage bags are denoted by D (Dry), W (Wet) and R (Recycle)
2
3// Input
4bags: ["D2W1", "R2", "", "W1"]
5
6/*
7In this case there are total 4 houses.
81st house has: 2 Dry waste bags and 1 Wet waste bag
92nd house has: 2 Recycle waste bag
103rd house has: 0 bags
114th house has: 1 Wet waste bag
12
13Note: Since the trucks have to come back to start position, the time travelled by the trucks will become double.
14*/Q2: You are given an array courseDependencies. The value at each index of the array denotes that in order to take course i, you have to first take the course courseDependencies[i]. If i is equal to courseDependencies[i] then course i can be taken without any pre-requisite.
Given a list of courses which should be taken, return the total number of courses you end up taking.
Ex:
1courseDependencies: [0, 0, 0, 3, 4], courses: [1, 4]
2
3Answer: 3
4Explanation: Before taking course 1, we have to take course 0 because courseDependencies[1] = 0.
5Course 4 can be taken directly because it doesn't have any dependencies.
6So total number of courses we end up taking are 0, 1, 4.Interviews
Round 1
Q1: Longest substring without repeating characters
Q2: For a linked list given as below with a next and child pointer. Write a function to print the elements in level order fashion.
110 -> 5 -> 12 -> 7 -> 11
2 | |
34 -> 20 -> 13 17 -> 6
4 | | |
5 2 16 9
6
7Output: 10, 5, 12, 7, 11, 4, 20, 13, 17, 6, 2, 16, 9Round 2
Q1: LLD (Low Level Design) of an online Ludo game
Round 3
Q2: Given a file system with a root directory with recursive directories and files inside it, design an iterator with MoveNext and HasNext functions. The iterator should return the files from the top level folders first before moving on to the next level.
Round 4
Q1: Tell me about a time you solved something big for a customer.
Q2: Given a string s, return the first repeating substring.
1//Example 1:
2s = "ABCBDAB"
3Output: B
4
5//Example 2:
6s = "ABCBCA"
7Output: BCCompensation Details: Offer Details