Rivigo Interview Experience for SDE-2
Round 1(Interviewer = SDE2): This round was totally DSA. I was asked 4 coding questions.
Two of the coding questions I remember :
Que1: Given an array containing 0 or 1 only. Find maximum subarray with equal number of zeroes and ones?
Solution: I first tried solving using brute approach O(n^2) by iterating n times for each index but later got to optimal solution using cumulative sum approach where first step is changing array to cumulative sum array , for element =0 decrement sum by 1 and for element =1 increment sum by 1. Now in updated array, a subarray which have start and end as same element will correspond to equal number of zeroes and ones. Now we have to find the maximum subarray by iteration for each index i.
Que2: Find maximum palindrome in a string ?
Solution: For each index i assume it to be mid in palindrome , now find leftmost index i and rightmost index j where a[i] == a[j].
This works in O(n*2).
Round 2 (Interviewer = Lead Engineer): This round was of System Design. I was given 1 problem which was asked to implement in any language.
Que: Implement LRU Cache with capacity c in Java?
Solution: I used HashMap and doubly linked list which supports get(key), put(key,value) operations in O(1) and always least recently used data will be removed from the list if number of elements crossed capacity c.
Round 3(Interviewer = Engineering Manager ): This round was of API Design
Que: I was given problem to build upload/review bill system. Was asked to write any one API
Round 4: (Interviewer = VP): This round was non tech round.
Que1: Tell me about myself
Que2: Why wants to join Rivigo
Que3: Most challenging problem I worked on till now
Round 5: (Interviewer = Cofounder): This round was also non tech round. Normal discussion upto what depth I have worked in previous companies and do I meet the criteria for this company.