MSFT Office, SQL, Azure team interviews

I decided to write a post about the interview questions for
SDE 2 (level 61) positions at Microsoft. The interview experience was better
than what I had before. I thought I could easily get the jobs but wrong. From
the feedback, I think it was more a disagreement on coding practices than
anything else. The recruiters did not have details on which code was buggy or
complicated. What they received from the hiring manager was a conglomerated piece
of feedback. Part of the interview was confidential such as people’s names. But
the questions asked were pretty much common interview questions anyone can
easily find on Google.

 

SQL server team:

Given a string like abcdef, rotate or shift the string n
characters where n < the length of the string without allocating a newt
string. Do it in-place. Hint: use multiple swapping

Check if a string is a palindrome in C. Change the string to
be Unicode 16. How do you modify the code?

Given a binary tree and 2 nodes in the tree, find the common
ancestor closest to the 2 nodes. Obviously the root is a common ancestor for
any 2 nodes but is the farthest from the 2 nodes.

Given a singly linked list, find the middle node.

Given a binary tree, implement breadth first search traversal
for each node to point to the next node. Each node will have an additional
pointer called next besides left, right child nodes. Hint: the data structure
is queue. What’s a good implementation of queue? Answer is linked list where
head is the end of the queue and the last list node is the beginning of the
queue. Change the code to use a singly linked list for the queue. Suppose head
and tail nodes are given in the list.

Given an array of 1000 elements where each element is
between 1 and 1000. Duplication is allowed in the array. Implement a sorting
algorithm that’s better than n log(n). Hint: what if the array has 10 elements
and each element is 1 or 2?

 

Office team:

Given a binary tree, write a function that checks if the
tree is a binary search tree without using O(n) space complexity. Change the function
to take 2 value parameters (Min, Max).

Given 2 sorted arrays, merge them into 1 sorted array
without using O(n) space complexity. Merge in place.

Convert string “2013/02/28” to “Thursday February 28th 2013”.
Given the leap year conditions and a base day of the week for 2000/1/1, write
the function code to determine the day of week for any given date after 2000/1/1

Write a function that checks if 2 singly linked lists intersect.

Think of the similarity between a sorted doubly linked list and a perfect
or full binary search tree. Imagine each node in the binary tree has a parent pointer.
Implement the algorithm to convert the binary search tree to a sorted doubly linked list.

 

Feedback from the teams:

Strengths: Good Logic, problem solving,
cognizant. Communication (easy to communicate). Smart, vibrant.

Weaknesses: Code was buggy, complicated,
too much time taken. They want Simple, functional code

 

The office team recruiter told me their hiring bar was the
highest among all divisions at Microsoft. Both team thought my code was not as
pleasing to them. At that level, they expect perfect code more than value the
thinking process. Maybe that’s the type of requirement for business software
jobs.

 

I am adding to the blog post about Azure Fabric controller team interviews. There were 2 senior SDE and 1 SDE 2 interviewers. Here are the questions:

 

Given 2 sorted arrays, the merge sort's algorithm combines the 2 arrays into 1 sorted array. Think of n sorted arrays. How do you combine n sorted arrays into 1 sorted array.

- the problem seems to be trivial. I proposed the solution of comparing the 1st element of each sorted array and pick the least element to be inserted into the big array. He said it will be O(n) time complexity just to compare. I proposed that just merge each 2 sorted arrays from the n sorted arrays. That's how merge sort works from the smallest arrays. That seemed to strike him as if he did not expect any candidates would've thought of that. Then I asked if there is a specific angle he wants me to go for. We ended up discussing using heap to record the minimal element from the collection of the 1st elements of the n sorted arrays.

 

Implement reader writer thread locking semantics.

 

Same old binary tree question: implement a module in an OOD way to determine if a binary tree is a binary search tree.

- use interface

Find the largest binary search tree in a binary tree

- this tricked me off. I could only think of checking from the bottom and count the number of binary search tree nodes. Solutions are at geeksforgeeks and leetcode

Given 7 characters like in the scrabble word game, return a collection of words that use the 7 characters. E,g, a b d g o f f. Word "dog" and "off" use the 7 characters but "bed", "fool" does not.

What if 1 out of 7 characters is a wildcard meaning it can be any character?

 

I managed to get feedback directly from the hiring manager without going through a recruiter. It was interesting to know all the background processing and decision making. It turned out that the hiring manager picked the top candidate who has the direct Windows Azure configuration related experience. The team is Azure fabric which is quite the core or kernel to Azure. There were 20 resumes > 4 candidates > 1 picked which is quite competitive. I made it to the hidden interviewer who was the principle development manager and the hiring manager's direct manager. Not bad. But still short.