Microsoft conducted their first round of shortlisting for placements and internship. The online coding round was organized by CoCubes like last year.
The test was for 1.5 hrs and had 2 coding questions. Allowed programming languages were C, C++ and Java.
The questions were as follows:
1) Given the head of two linked lists , find the merging point of both the linked lists. In case the linked lists do not merge then return NULL.
2) Given a 2d array of 0s and 1s where 0s represent water and 1s represent land. A connected patch of 0s count as one single water body and if a water body is covered by 1s all around it then it forms one pool. Write a function to return the total number of pools in the 2D matrix. In case a water body is present on the boundary of the array immediately return -1.
Sample test cases :-
Input : 11111 10101 10111 11111 11111 Output : 2 Input : 11110 11111 11011 11011 Output : -1 Input : 11111 10111 10011 11011 11111 Output : 1
If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.