# Nutanix Interview Experience for MTS Intern | Off-Campus 2021

Hey guys, I recently interviewed for the Member of Technical Staff (MTS) intern position at Nutanix. The entire process was virtual due to the ongoing pandemic situation and comprised of 1 coding round, 1 debugging round, and 2 F2F interviews. Following were the interview questions:

**Coding Round (2 Questions – 75 mins):**

Hey geek! It's time to become a success story instead of reading them. Check out our most renowned **DSA Self Paced Course**, now at a student-friendly price and become industry ready. And if you are looking for a more complete interview preparation resource, check out **Complete Interview Preparation Course**** **that will prepare you for the SDE role of your dreams!

Feeling prepared enough for your interview? Test your skills with our **Test Series** that will help you prepare for top companies like **Amazon, Microsoft, TCS, Wipro, Google** and many more!

You are given a binary matrix (can have only 1s and 0s as elements) with n rows and m columns initially consisting of all 0s. Q queries follow. The queries can be of 4 types:

- 1 R index
- 1 C index
- 2 R index
- 2 C index

In each query, the first input is the type of the query, the second input is whether we have to consider the row (R) or the column (C) and the third input is the index of the row/column. For each type 1 query, we need to flip the elements of the row/column having the given index. For each type 2 queries, we have to output the number of zeros present in the row/column having the given index.

**Constraints:**N - 1 to10 ^ 5, Q - 1 to 10 ^ 5.

Given a matrix with n rows and m columns, where each element is a number from 1 to 10 ^ 9, we need to find the longest increasing path i.e the next cell should have a value greater than the current cell. We can only move to adjacent cells i.e cells that share a side with the current cell. Also, the path can start and end anywhere in the matrix but no cell can be visited twice.

I was able to do 1.5 questions. For the second question, I used a DFS + DP approach and all test cases passed. The solution was similar to https://www.geeksforgeeks.org/find-the-longest-path-in-a-matrix-with-given-constraints/. For the first question, I made a brute force attempt which cleared half the test cases. I had some prior commitments, so I had to finish the exam within an hour, so I didn’t try to optimize it further. Fortunately, I still made the cut and was shortlisted for the next round.

**Debugging Round (1 Question – 45 mins): **The next round was a debugging round. There were approximately 20 people in this round and all of us had to give this round simultaneously. We were given a piece of code for **concurrent file writes and sequential **acknowledgments and as you would have judged from the name, it was an Operating System (OS) based round. We were each given a separate document with the problem statement and the code. We had to suggest changes and comment on what was wrong with the current code, why we thought that change should be there etc. Since I hadn’t prepared for OS at all I got dejected initially, but then I noticed that all the functionality was clearly mentioned in the problem statement which meant most of it could be done simply by understanding the given code. We were asked only to look out for logical faults and not syntax errors. By the end of it I had pointed out 10 or 11 faults, and I was quite satisfied with it. I would say more than knowing about the theory, this round was to see how good you are at understanding existing code and figuring out basic errors and logical faults. 9 people were shortlisted after this round.

**Technical Interview 1 (Data Structures and Algorithm Round – 1hr): **The first F2F interview was a DSA round. Initial 5 mins went in the introduction. Then I had to log in to the code pair link on hackerrank and she gave me a question. So the question had sort of like a common premise on which follow-up questions were asked. The premise was as follows:

There are n houses in a row. The houses are indexed from 1 – n. Each house has some amount of money associated with it and you are given the values in an array. Now a volunteer has to collect money for some NGOs. There are 2 ways in which a volunteer can collect money:

- The volunteer can collect money in any order of houses.
- The volunteer can collect money only from consecutive houses.

Now there are 3 NGOs. Any volunteer that distributes an equal amount of money to all three NGOs is eligible for an award. We need to find the maximum number of volunteers that are eligible for an award. It is given that multiple volunteers can collect money from the same house but one volunteer cannot collect money from the same house multiple times.

Given this premise, there were 4 questions asked one by one:

- Find the maximum number of volunteers that will be awarded if all volunteers can collect money in only the first way. It is important to understand from the premise that this simply means finding the number of subsets of the array such that their sum is divisible 3. Thus, I provided a Dynamic Programming solution of time complexity O(n) and space complexity O(n). She further asked what if there were k NGOs. The complexity would simply change to O(n * k) time and space complexity. I had to code the entire solution.
- Find the maximum number of volunteers that will be awarded if all volunteers can collect money in only the second way. Again we have to understand that the problem now changes to identifying the number of subarrays with a sum divisible by 3. Thus, I used a Hashmap-based approach which is similar to https://www.geeksforgeeks.org/count-sub-arrays-sum-divisible-k/. I had to code the entire solution for this as well.
- Find the maximum number of volunteers that will be awarded if all volunteers can collect money in only the second way given that there are queries of the form (l, r) such that you can only consider houses in the range [l, r]. The number of queries was up to 10 ^ 5. For this, I used a segment tree approach, and she was impressed by the solution as she was expecting something else for the question.
- The last follow-up was that in the previous question, we can now have queries of the form (index, val) which means change value of the house at the index to val. This was again very easily handled by the segment tree data structure.

This round went extremely well and the interviewer was very impressed as she wasn’t expecting the interview to go on till the 4th follow-up question and praised me for the same.

**Technical Interview 2 (System Design Round – 1hr): **The final round was a system design round. I was asked to do a system design for Pastebin and a set of requirements were given which I had to fulfill. Having never done or not even knowing anything about System Design rounds I was a bit nervous and had just skimmed through random blogs on the topic 15 mins prior to the interview. However, the interviewer was very helpful and was guiding me throughout. I had to give the signatures for the APIs, discuss which type of database I would use and its pros and cons, the various collections that the database would have, how to handle caching, the design for LRU cache, etc. It was a very interesting round and in fact, I learned a lot in the round itself. I finished the round well within time and was very content with how the round had gone.

**Verdict: **I was selected and was offered the internship for a period of 5 months starting February 1st! ðŸ™‚ It was one of the smoothest interview experiences I’ve had, and I am thankful to Nutanix for the same.