Delhivery Interview Experience 2020 - New Grad, India
Anonymous User
1076

The Online assessment was hardest i have ever gave, I think Hackerearth go nuts sometimes. For pay package of 8-9 lakhs INR , these should not be the questions, Anyway -:

  1. Sum Calculation -: You are given N positive numbers A1,A2..An and you have to calculate total sum of floor( Ai / Aj ) for each pair of indices i and j where (1<=i<=j<=N).

    • Constraints : 1<= Ai <= 10^5
      (So basically any approach of n^2 will fail, max time limit possible is nlogn)

    • For 1,2,3,4,5 , o/p-:27

  2. You are given an integer N and you need to find two numbers say x and y such that the product of x and y is greater than or equal to N and the sum of x and y should be minimum. You need to print minimum sum of x and y.

     * 	Constraints -: 1<=N<=10^18  ( so  Log N solution is required or constant time approach by some mathematics approach)

Ex. For N=15, ans=8.

  1. You are given 1 indexed array A with n integers. Find an index i such that 1< i < n and the difference between the number of integers greater than a[i] in range 1 to i-1 and number of integers lesser than a[i] in range i to n is maximum. Output maximum absolute difference.

    • Constraints: 3<=N<=10^5 and 1<=A[i]<=10^9 (so NlogN will work as n<=10^5)
    • For input -: 1 4 2 7
      • O/p -: 2
      • Total elements greater the 2 in left is 1 and total elements greter then 2 in right is 0 so answer is 1-0=1.

I just did last one with Binary indexed tree (Fenwick tree) , later i realised it could have been done by just counting inversions. Anyway, i got a call for interview.

  1. Which tech stack you have worked.

  2. We have to develope a data structure such that it have random acces time as an array have but we can store only integers or floats or same data type in arrays, but in our data structure we can store structure, floats, integers, pretty much everything and we require random acces time as o(1).
    * It blew my brains out.

  3. Seggregate 0's and 1's -: I gave a o(n) approach but he asked me to optimise time complexity so i thought i must find a o(log n) solution and boom, i was not able to find one. Then he told me answer with an o(n/2) time complexity saying it is optimised.
    * It blew my brains out a little more

  4. Validate a BST -: Now i was done, in this question, i was all thinking about the first and second question and so i just decided to think what just happened with me and not think about the question and after 5 minutes when he asked my approach i told him i was thinking about what just happened, not the question.
    *it blew his brains out.

    MISSION PASSED - RESPECT 9999+

So you guys have already guessed what was the result. It was my part to community.
And if someone is able to do OA questions post the solutions down here. Peace. StayAlive.

Comments (7)