Education: B.Tech from Tier 1 institute
Current Experience: 1.6 years
I applied directly on the career portal and got a call for interview within a week.
Round-1
Video interview conducted on hackerrank code pair. 2 problems to be solved in 60 minutes.
Problem-1
Given two arrays arr1 and arr2 of n elements, we need to find the maximum value of sum i*(arr2[i] - arr1[i]), where we can rearrange each element of each array as we like.
n<=10^5, arr1[i], arr2[i] were positive integers less than equal to 10^9
Approach: I solved by sorting first array in ascending and second array in descending and then calculated the required sum. Similarly sorted first in desc and second in asc and then took max of two situations.
I missed the fact that we had to calculate the answer modulo 10^9+7. Was able to identify after interviewer asked to check the constraints properly.
Did one more small mistake. In c++ sort function I used sort(arr1.begin(), arr1.begin()) instead of sort(arr1.begin(), arr1.end()). That wasted few minutes to figure out. Was probably out of practise
Problem-2
It was a little confusing statement but boiled down to something like
Given an array of n elements, we need to build a score array of n elements.
To build score[i], we need to do following
- Find the maximum of arr[1...i]. Then add it to arr[1]
- Find the maximum of arr[1...i] of this new arr and then add it to arr[2]
- Similarly find max of arr[1...i] of this new arr and then add it arr[i].
Now we need to do sum of arr[1...i] of this new modified array. This value becomes score[i].
After each iteration the array starts fresh, i.e. we calculate score[i+1] on original arr.
Approach: I wrote few examples and found out a formula
score[i] = i*max(arr[1...i]) + i*arr[1] + (i-1) * arr[2] + ... + 1*arr[i]
This can be easily solved using prefix sums.
I managed to solve both problems but just 3 mins were left for the interview.
It has been more than a day and there has been no reply back from the HR.
Should I keep any hope?
Update: Received a call after 10 days for further rounds. Had 2 more rounds after this.
Round-2
2 DSA problems to be solved in 1 hour
- https://leetcode.com/problems/spiral-matrix/description/
It's a well known problem. Although took around 15-20 mins to complete the clean and working code. - https://leetcode.com/problems/reverse-nodes-in-k-group/description/
Again a well known problem, but I messed up this one. Got very much confused in visualising how to move the linked list pointers, should have drawn it out on a paper :(
Interviewer tried to hint me for a recursive solution but I was thinking about iterative one. In the end could not complete this problem. Felt very disappointed with myself.
Round-3
1 DSA and 1 LLD problem in 1 hour
- It was a standard leetcode problem https://leetcode.com/problems/number-of-islands/description/
Solved it without any difficulty. - Implement a thread safe LRU cache.
I studied this long back but luckily remembered the idea and was able to code it also. Had good discussions with interviewer around ensuring thread safety.
Got the feedback that 2 rounds were good, 1 was ok. No further updates on whether I would be called for HM round. I feel they won't be proceeding forward but waiting to get final confirmation.


