Microsoft Interview SDE intern 2019
There were 3 questions in the online round .2 questions related to simple array manipulation and one bst.
Those who did atleast 2 questions were selected for other rounds.
It was group fly round where in we were given 2 questions.
1st : There is an array which is sorted but rotated at one end. you have to find the given element in that array.
Expected time complexity : logn.
I gave the solution using binary search.
reference : https://www.geeksforgeeks.org/search-an-element-in-a-sorted-and-pivoted-array/
2nd question :
Check given tree is BST .
Technical round :
He asked me about my project which i have done till now.I just explained him about my python web scrapping project.Then he went for questions.
1st : you are given a bst, you have to print the sum of all nodes whose value is greater than or equal to the present node.(this has to be done for every node present in the bst)
He asked me to write the code on paper.
my approach : First calculate the total sum of nodes in the bst using inorder recursive function.
Again traverse the tree in inorder, maintain a sum_prev which is adding node values.Print sum-prev_sum. prev_sum+=node_value
void sum(Node* root)
void solution(Node* )
he asked me to try it in one loop.I gave it in one loop using : https://www.geeksforgeeks.org/add-greater-values-every-node-given-bst/
2nd question based on kadane’s algorithm.https://www.geeksforgeeks.org/largest-sum-contiguous-subarray/
1st question minimum length of maximum sum array.
I gave this solution using kadane’s algorithm with maintaining prev_minimum_length as a variable
2nd question : right view of binary tree
i gave my solution using level order (queue)
She asked me to write the code on paper.
She asked me about my projects.
Senior SDE Engineer took my interview.
He first asked about me and some random stuffs, hobbies and all.
then he asked me one question :
Given n points in a globe/2 dimensional infinite matrix . Find the closest point to a given point.
o(n2) solution not expected.
I approached it by making some tiles for every point . Then i told him that we can first search it in near 8 sqaures /tiles near that given point.Then he took out some mistake and asked me to think more as i m going in the right direction.
Then I told him that i ll sort the points according to x variable and then y and then restrict my search for the closest point in the region bounded by that points .
he told me not to code as i have coded in all the rounds.
My all interviews went quite well and results came after 15 days and I was selected.
Just focus on interview specific questions, Operating systems, DBMS, and data structures .
Before going for interviews Read some interview experiences .
Thanks you geeksforgeeks for such a good platform to prepare for interviews.
Please Login to comment...