Round One :
It was an online coding test conducted on HackerEarth. A test consisting of 3 coding questions.
- given an integer matrix(m) of the NxM dimension.In one move you can go from position (i,j) to eighter (i+m[i][j] , j) or (i,j+m[i][j]). Initially, you are on at (1,1) and you wanted to reach (N, M). So, you have to print a minimum number of moves to reach (N, M), and if it is not possible then print -1. NOTE: You can not jump outside the matrix. (i.e. in any move i+m[i][j] < N or j+m[i][j]<M). (75 Marks)
Hint: Minimum distance between source and destination using BFS algorithm.
- There are N different packages. the ith package is of X[i] days and the price of that package is Y[i]. There are M customers. the jth customer wants the package of at least A[j] days and he doesn’t want to spend more than B[j] for any package. One package can accommodate at most one customer and a customer can buy at most one package. You have to find the maximum number of packages, you can sell. (100 marks)
- Given two binary strings A and B. In one move you can choose any two adjust numbers from string A and replace any of them with XOR of them and another one with OR of them. Ex: A=0010110. You chose 0 and 1 so, 0 XOR 1=1 and 0 OR 1=1 so, 01 becomes 11. You can apply this move on string A any number of times and it is possible to make string B from A then return YES otherwise NO. (50 Marks)
My first and third are accepted and the second one is partially corrected and I got 90 out of 100 in second. So, I am shortlisted for the next round along with the other 47 students.
Round Two(Technical Round- Face to Face) | Online Interview:
The Interviewer was very nice and he made a very comfortable environment. First, he introduced himself and also explained to me about his work and project. Then he asked me to introduce myself. Then he asked me a coding question.
- Given a numeric string of length N and an integer K. You have to erase K digit from string i.e. remaining string is smallest possible. EX: Given string 56138451 and K=3 then erase 6(at 2nd), 5(at 1st), 8(at 5th). Hence answer is 13451.
My first approach was wrong and then he asked me to take different inputs and find output and then I came with the brute force method of time complexity O(K*N). We discussed this approach and he asked me to reduce the time complexity. I tried out different ways and at last, I came up with an O(N) approach. We discuss that approach and then he asked to implement that approach.
At last, he asked me if I had any questions for him.
Round Three(Technical Round – Face to Face) | Online Interview:
The interviewer has directly started with the coding question.
- You have an empty space of L length. given an array W. W[i] is the width of the ith tree. W1, W2 …… all are different and you have many trees of that width. You have to plant a tree in space of length L i.e. No empty space is remaining in other word sums of a width of planted trees is L. This is a standard question of DP. Please go through the coin change DP problem. (This is the same question.) here is the link of that problem: https://www.geeksforgeeks.org/coin-change-dp-7/
First I told him that this problem has both properties of DP. (Overlapping Subproblem and Optimal Structure) and then I wrote the mathematical equation of DP and then discuss this approach with him. He asked me to implement this and also asked me to draw a table of DP.
- We discuss about Hashmap in details and he asked me to write a class of hashmap. I implement a Hashmap class using modular as a hash function and wrote insert and find method in the class.
- At last, he gave me a situation like you have to prioritize the student on the basis of the number of interviews, he has given(Student with a lower number of interviews goes first). If two students have given the same number of interviews then the student with a higher score in the exam goes first and the score of the exam is unique. then asked me what data structure should I used and how can I solved this problem. I told him we can use set<pair<int, int>>. But he told me that if in other languages doesn’t support set then what? So, I explained to him then we can also create our own data structure on the basis of a Binary search tree and AVL tree and then we discuss about binary search tree.
Round Four(Technical Round – Face to face) | Online Interview:
there are two interviewers in this round. He asked me the following question,
- https://www.geeksforgeeks.org/detect-loop-in-a-linked-list/ (First I asked him if I could change the value of node but he told me that assume link list is immutable So, I discuss and implemented Floyd’s Cycle detect Algorithm.)
Problem Statement: Given my location and given an array of N different driver’s location. So, how can I find the nearest driver location? I told them to use set<pair<int, int>> and the first argument is the distance of the ith driver from me and the second argument is an index of driver that is I. and discuss the time complexity of insert and erase function of set and algorithm of this problem’s solution.
Problem Statement: There is a building of the N floor and there are two lifts in that building and I have to design a time-efficient algorithm for these two lift. He said that there is no optimal solution for this but just wanted to know how many different scenarios you can think.
At last, he saw my CV and asked a question from my project. and then he asked me if I had any questions for any of them.
Final Round (HR) | Online Interview :
It was a very interesting round and very chill. She asked very typical HR question like Why do want to join sprinklr?, Introduce your self. Then asked some question from my resume.
At last, she asked me if I have any questions for her. Asking questions to the interviewer is a good sign as it shows your interest in the company.
Final Verdict: SELECTED
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.