Microsoft | SDE 2 | Reject
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2022-01-27Added By Anonymous
Source: Link
Round 1: Online assessment, 2 medium level questions on Codility.
Round 2:
1Q1: Given "n" objects having structure,
2{
3 emailId: string
4 firstName: string,
5 middleName: string,
6 lastName: string,
7 teelphone: string,
8 address: string
9}
10
11for e.g.
12
13x = {
14 emailId: abc@xyz.com
15 firstName: Ramesh,
16 middleName: Kumar,
17 lastName: Sharma,
18 teelphone: ,
19 address:
20}
21
22y = {
23 emailId: abc@xyz.com
24 firstName: Ramesh Kumar,
25 middleName: ,
26 lastName: Sharma,
27 teelphone: 123456789,
28 address:
29}
30
31
32z = {
33 emailId: abc@xyz.com
34 firstName: Ramesh Kumar Sharma,
35 middleName: ,
36 lastName: ,
37 teelphone: ,
38 address: xyz street, abc City
39}
40
41
42write an algorithm to merge the records, where emailId can be used as unique identifier and you need to merge other attributes.
43
44For above input, output will be something like:
45
46o/p = {
47 emailId: abc@xyz.com
48 firstName: Ramesh,
49 middleName: Kumar,
50 lastName: Sharma,
51 teelphone: 123456789,
52 address: xyz street, abc City
53}
54
55Its not mandatory that first, middle, last names can have atmost one word, it can be more than one word as well.
56
57Q 2: Given a list of words, and a word "x". Can you find if given word x can be formed by merging any two words for given list.
58
59For e.g. words[] = {"abc", "xyz", "efg", huj}
60
61x = xyzabc => output = true
62x = efgabcd => output = falseRound 3:
1Q1: Given schedules of n members, schedule = [startTime, endTime]. Can you find the earliest slot in the
2day of "X" hrs where all members are free, if you can't find a slot return -1; You can imagine day starts at 00:00 and ends at 24:00
3
4a = [[0:00, 1:00], [2:00, 4:00], [8:00, 12:00]]
5b = [[1:00, 4:00]]
6c= [5:00, 8:00]
7
8
9if X = 1 hrs => ans will be [4:00, 5:00]
10
11Follow up questions -
12
131) Write different test cases?
142) what if X is real, some thing like 1.5, 1.2?
153) What if all users are in different timezones?Round 4:
Q1: Given a string, can you move all vowels at start of string, numbers in the middel and cononants at the end?
Q2: https://leetcode.com/problems/valid-parenthesis-string/
Round 5:
1Q1: Given different IP ranges, with owners for each range
2
3Range - Owner
4
5[1.1.2.3 - 1.4.5.6] - A
6[2.6.7.8 - 3.4.5.6] - B
7[4.5.6.99 - 10.12.3.5] - C
8.
9.
10.
11.
12[253.12.12.4 - 255.255.255.255] - Z
13
14Now, given an IP address can you find who is the owner of that IP.
15
16For e.x -> 1.1.3.4 => A