UHG Interview Experience (On-Campus)
Round 1: The round 1 was an online test, on cocubes platform comprising of two sections.
Aptitude (30 questions in 30 minutes.): Again, it had two subsections.
- logical reasoning. 20 questions , 20 minutes. All the questions were paragraph based.
- Quantitative reasoning: 10 questions, 10 minutes. Again, paragraph based questions.
Coding Section: Two questions, very easy, 30 minutes.Every one got different sets. Some of the questions were:
Round 2: 35 people were shortlisted for this pen-paper-code round. People were divided in groups of nine and were being called group by group. Every group was given a question which was completely open-ended, and we had to write code in any language of our choice. Each individual was given 45 minutes. the four questions were:
- Problem Statemenrt: Given a graph implementation like , for eg, Facebook, find the minimum degree of separation betwen two given people. It is also given that the graph is implemented by using linked lists. The people who could see that the question demanded minimum path between two given nodes in a graph represented through adjacency list solved the problem by applying Djikstra algorithm after taking any of the given nodes as source.
- Problem Statement: Find the trending words on Twitter. Again, a very blunt, open-ended question that didn’t define much. They wanted to test the analytical, coding skills as well as thought process of the students. They were expecting features like, frequency-based sorting of the words giving priority to the timestamps(that’s what trending is, right!), remove the special characters like #,$,@, etc, do not count the common words like is, am,are, the, preositiions and all. Two or more similar words, for example, #metooo and #meeeeeetoooouuuuuu.. be cosnidered same and many things else.
- Problem Statement: Maximise profits in stock given you can buy and sell stocks given k times. https://www.geeksforgeeks.org/maximum-profit-by-buying-and-selling-a-share-at-most-k-times/
- Problem Statement: Krithika has got a new prime subscription and have watched k movies. Help the prime people in suggesting her the (k+1)th movie. Basically, design a personalized recommendation engine. (w/o using ML libraries obviously! They wanted a C/C++/Java/Python code). This is the question I was asked. Again, a very open-ended question. They had come with plans to grill us and check our thought process. How I approached this problem was, I took both the conditions to filter out the remaining movies which are:
- 1. Item-based filtering: You have watched this movie, so you are more likely to watch movies of this type. For this, I had created a structure in C++ called movies, which contained different components like Genre, Rating, Studio, an array of Actors , release date, and an array of struct(Persons) which contained the list of people who had watched the movie.
- 2. User-based Filtering: People who have watched this movie have also watched thse movies. For the implementation of this feature, I created a structure person which contained name, age, nationality, profession and an array of struct movie that he has watched. Now, the process was, for each of the movie she has watched, I was comparing it first with all the features of every movie present in the database which is nothing but right now, an array of movies, and generating a score accoridng to an arbitrarily assigned priority right now. For the user-based filtering, for each of the movie that she has watched, there must be an array of persons who have also watched that movie, so again, traverse through that array and then inside that array, there must be an array of movies he would have watched, compare it with those and then generate the final maximum score from all of these. Finally, from all the scores generated the movie with the highest score is recommended.
Round 3(Technical Interview): After writing the code for the last round and submitting it, everyone was being called one by one and were being asked to explain the code and then discussion about the projects done and some SQL queries. In my case, there were three people togerther whom I had to explain my logic first, then, they started questioning.
- You have assigned the priority arabitrarily to generate the score. What if this priority is wrong for the person? If the recommendation is wrong, the person will obviously not watch the movie or leave it in between. So, let’s take a time-limit, and if until then, the movie is not watched, some other feature will be given priority and some other movie will be recommended and the different features are put into a circular queue. Apart from this, all the recommended and not watched movies should be kept in an array options and keep recommending them from time to time. Like giving them rest for now, and then comparing again, with the max score movies to go for recommendation.
- Although you have covered many great features, to do so, the time complexity is O(n^3), and for such a large database, dynamically calculating and showing this will impossible. How are you going to improve this? Well, for comparisions, I can partiiton the movies in different buckets so that the exhaustivity can be reduced, and put them in different sets which works in logn for searching. That’s how for two level of loops are converted to logn, thereby reducing the time complexity to n(logn)^2.