Hello everyone,
Recently finished up the Microsoft 4 round onsite interview. This was for the entry-level position (USA). I don't know what level it is, but I will say I had a great experience. Here were the questions I got (1 coding question per interview, then a bunch of behavioral questions).
- Implement a queue using stacks.
public class Solution {
public static class queue {
Stack<Integer> stack1;
Stack<Integer> stack2;
public queue() {
stack1 = new Stack<Integer>();
stack2 = new Stack<Integer>();
}
public void enQueue(int num) {
stack1.push(num);
}
public int deQueue() {
if (stack2.isEmpty() && stack1.isEmpty()) return -1;
if (stack2.isEmpty()) {
while (!stack1.isEmpty()) {
stack2.push(stack1.pop());
}
return stack2.pop();
}
return stack2.pop();
}
}- https://leetcode.com/problems/add-two-numbers/ and a follow-up, how would you do this if it wasn't already in reverse order (just talked about follow-up)
- A modified word search problem (https://leetcode.com/problems/word-search/). This essentially was the same thing only the words had to remain within the same row/col/diagonal. For example:
A B C
D E F
G H I
Given a word list with [ABE, AEI], ABE would not be found and AEI would be found. I did this using DFS, and talked about optimizing it using a trie. - Given a string, find whether it has completely unique characters. If all characters unique, then return true, otherwise return false. For instance: "abcde" -> true, "forever" -> false. Very simple, took about 5 minutes total for coding portion and that was all.
Overall, super chill and fair final round.
Comments (6)


