# Rubrik Interview Experience for Internship (On-Campus )

**Criteria: **8 CPI or Above (only CSE, MnC). All students irrespective of history of backlogs or current backlogs were considered if they satisfied the CPI criteria.

**First Round (Online Test): **This first round was the Online test which was around 1 Hour 40 Minutes long(don’t remember the exact time).

There were 4 coding questions(don’t remember exact questions):

(Medium)Given 2 arrays A and B. Make B equal to A in minimum no. of operations. In each operation, you can remove any element from array B and put that element in front or end of array B. We need to output the number of operations. (Hint: let x= longest contiguous subarray of A which is also subsequence of B. Answer is n(size of array A or B)-x )

(Medium-Hard)Given the health of king(N). You need to find the minimum no. of stabs to kill the king. The king dies if the health becomes 0.

If at any point health of king is h, in one stab you can do any of following: (decrease h by 1) or (decrease the health to h1 where h= h1*h2 and h1>=h2>1)

(Medium-Hard)Given a tree and a source(S) and destination(D). Every node of the tree has a colour(Red, Green or Blue). Going from one node to another takes one second and staying at one node for 1 second give you a colour ball(of the colour of that node). You have to find the minimum time taken in order to reach from source to destination ensuring that the number of balls of each colour is equal and non-zero. (

**Hint:**at end, you must have 1 ball of each colour. BFS and multiple sources BFS will do work)(Hard) Can not remember the question (Not able to solve)

This round was conducted on Hackerrank (Webcam Enabled). After this online test round, 10 students were shortlisted for interviews.

**Second Round(Technical Interview-1 Almost 1hr 15min): **This was an Online F2F Technical Round conducted on zoom. Interviewer shared codepad link and you were asked to code and pass sample test case given by the interviewer. Only one question(coding) was asked(More follow questions).

Initially given array is empty. There were q queries. You need to output array after all q queries. There was 2 type of queries. (Add x: push x to an array)(Xor x: Take xor of all elements present in an array with x).

Expected Time Complexity: O(q)

(**Hint:** Use vector and hashmap)

**Query type 1:** Add x (Simply push x to vector)

**Query type 2: **Xor x (Store size of the array as key and x as the value in hashmap)

After all, queries use hashmap to change elements of a vector and return the final vector.

I was able to crack it and code it. Then (follow-up question) 1 more type of query was added (Min: You have to give min of all elements in vector till now). Again Expected Time Complexity: O(q)

I came up with idea and interviewer was satisfied with my approach.

After this round 7 students were shortlisted for next round.

**Third Round(Technical Interview 2 Almost 1hr 30min): **Again pattern was same(Zoom video call, and I was asked to code and 1 question was there(+Follow up)).

**Link for question:** https://leetcode.com/problems/scramble-string/ (Hard question)

The interviewer didn’t explain the problem completely. I was supposed to ask questions and clarify the statement. I came up with the idea and discussed it. The interviewer was satisfied with my approach. I was asked to code and run on the sample test case given.

(Follow up) was just a manipulation of given question and that was easy to crack(Once original one was cracked).

**Advice:** Before running code just go through it and see if there is any common mistake(Solving problem on onego is good to follow (Covering all corner test cases)).

After this round 4 students were shortlisted for next round.

**Fourth Round(HR)(Almost 1hr)**: Interviewer introduced himself and then I was asked to introduce(Just be prepared with this type of questions. Don’t speak up all things that are written in your resume).

Then after this, there was project discussion for about 45 minutes.

After every interview, I was asked: “Whether I have any question for them”. Just ask a question about the company. This how your interest in their firm.

Overall it was a great experience and I got an opportunity to intern at Rubrik in summers.