Google L4 | SDE 3 | Preliminary screening round
Anonymous User
2113

Problem Statement:

You are given three sorted arrays A, B, and C, each of the same length, and an integer d.
Your task is to find the number of tuples (i, j, k) such that:

|A[i] - B[j]| <= d  
|A[i] - C[k]| <= d  
|B[j] - C[k]| <= d

Example -

A = [1,5,5] , B = [3,4,5] , C = [6,6,8] and D = 1

ans = 4
------------------------------------------------------------------

It was really a very nice question.

I tried to optimized, using Binary search but could not figure how to implement. Interviewer gave me couple of hints.
At last 5 mins , I coded up the solution. And then he asked the TC and SC and thats was the end. My interview not went very well, as I struggled a lot, brainstoming in find the Range of the Binary Search.

What are my changes to get into the interview process?

And, share your thoughts about the question ....

Update - REJECTED, cooldown 1 year

Comments (15)