DP World Interview Rounds
Round 1 (Technical Round 1)
I introduced myself.
Q1
You are given an integer array height of length n. There are n vertical lines drawn such that the
two endpoints of the ith line are (i, 0) and (i, height[i]).
Find two lines that together with the x-axis form a container, such that the container contains the
most water.
Return the maximum amount of water a container can store.
Input: height = [1,8,6,2,5,4,8,3,7]
Output: 49
Explanation: The above vertical lines are represented by array [1,8,6,2,5,4,8,3,7]. In this case,
the max area of water (blue section) the container can contain is 49.
Input: height = [1,1]
Output: 1
Input height = [1,2,3,4,5]
output = 6
I asked a clarifying QN.
Then, I initially conveyed that this QN couldn't be solved with greedy and would need DP. The
interviewer helped me there, he told me to use greedy, something like ‘Sliding Window’
I got the initial idea. I told him, we set l = 0 and r = last_index and we’ll move from both sides.
Setting the maximum, we’ll have a maximum on whether to reduce r or increase l.
But then, I couldn’t be sure that this would work. So he told me the exact approach and asked
me to code it in 2 minutes. I made a silly mistake in the code and the output was off. He told me
to move on
Q2
Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return
the number of islands.
An island is surrounded by water and is formed by connecting adjacent lands horizontally or
vertically. You may assume all four edges of the grid are all surrounded by water.
Example 1:
Input: grid = [
["1","1","1","1","0"],
["1","1","0","1","0"],
["1","1","0","0","0"],
["0","0","0","0","0"]
Output: 1
Example 2:
Input: grid = [
["1","1","0","0","0"],
["1","1","0","0","0"],
["0","0","1","0","0"],
["0","0","0","1","1"]
]
Output: 3
I asked a clarifying question
I made the observation that this qn seems like a Graph problem and can be solved with
DFS/DSU
He asked me for the full form of DSU. I didn’t know. (I said I know U stands for Union)
I explained him the DFS approach, he understood and asked me to code it.
I coded it. While, coding firstly he was sitting write beside me watching me code. If that wasn’t
unnerving. He kept correcting me. Like I am midway in an if statement and he was pointing to
an error in that line, before I have completed it.
I generally type the whole thing and then check, so it was annoying for me.
Anyways I completed the code, there was some subtle bug somewhere. Again Output didn’t
match
He said to me “Your Resume is better than most 5-6 year experienced ppl, so I would really like
to help you out. You should connect with me on Linkedin, I will give you a detailed feedback.
But we are looking for something else”. I enquired he said we are looking for problem solvers.
(I was sure here, he was rejecting me)
I asked maybe, if you give me another QN, I can get the approach in 2-3 minutes. He said sure.
He gave me this QN . I solved it in under a minute. Told him the observation, Bruteforce, and
Optimal Soln. (The Bruteforce was O(N^3), I gave (N^2 logn), though the most optimal on
leetcode is O(N^2)).
But he seemed pleased with it. He said okay and asked me if I had any questions.
While I was leaving, he told me that since he is backend engineer, he can understand most of
my projects, and can only judge the projects on the basis of what he knows. I.e backend.
In next line, he contradicted himself saying “Quality is more important than quantity”.
At this point, I was 60% sure I wasn’t move forward. But, I hope the 3rd QN I solved in under an
minute might save me.
After a lot of wait, somehow I made it to Round 2.
Round 2 (Technical Round 2)
Round 2 has 2 DSA question again. This time good ones.
QN1
I initially went forward with a greedy approach. We dry runned it and he showed why it wouldn’t
work. After that, he said you might want to look at graphs.
Then, the answer just clicked for me. I explained the approach to him. He was happy with it.
He told me to code it.
(We were using a Weird Pair coding IDE, and on it the cursor was repetitively moving to the first
line. Which wasted 10-15 minutes of our time)
He told me code it in VS Code. There were a couple of syntax errors. I solved most of them one
by one. There were a logical error. I ran debugging to find the logical errors.
Ultimately, I solved it.
QN2
I explained what I understood about the QN, immediately conveyed to him, that this is a
connected component problem. It will require DFS/DSU. He was impressed with how quickly I
got the idea. He asked me to pseudocode it. I explained the approach to him. I didn’t had the
time to write the pseudocode.
He asked me If I had any questions for him. I asked about Work-Life balance.
I also asked that in the PPT, I asked the CTO about the tech stack used in DP World.
He said, they used Java majorly, but any tech stack there is. They have used it.
So In order to impress him. I asked him that DP world needs to route containers, so they must
need to solve the Travelling Salesman problem. But it is a np-hard problem, don’t they face any
issues while solving it using Java.
I was almost immediately called for Round 3.
R3 (HM Round)
The interviewer was a very chill person. He was directly telling me to search for the question
name and open it on leetcode. He was checking if I had solved the problem previously.
Q1
I was able to solve the question in 3 iterations. He wanted me to solve it in 2 iterations only.
We spend some time on it. The 2 iteration solution didn’t click me. But he was impressed with
my approach
He was trying to find the next QN. But, for all the questions he was giving, I had already solved
them on leetcode.
Q2
I gave the approach in 1 minute. He understood the approach. We moved forward
Q3
Again, I solved the QN in 1 minute. He understood the approach. He asked me to code it.
I made a few syntax errors. I coded it in 5 minutes. All Cases passes
Now, we had time, so we moved back to Q1. He gave me a hint. I understood it, and I got the
algorithm. I explained it. He understood.
He asked a few questions about it. I answered both of them. Got them right
He seemed satisfied. He asked If I had any questions. I again asked the same NP Hard
question and Travelling Salesman Algorithm.
I immediately was called for another round. But, instead of having an HR Round like most ppl
who were called with me. I was sent for another technical round.
Round 4 (Extra Technical Round)
I didn’t like this interviewer, he was quite senior. In his late 40s, or 50s.
He asked which language do you know the most. I said CPP.
He said “you must know what is a virtual destructor is, implement the code for it” (I have never
heard this in my life). I said it didn’t know what a virtual destructor was, so he asked tell me what
all you know in cpp.
I said struct, classes, final, static, STLs.
He asked me, What is overloading and overriding and told that correctly.
I said “OS is my stronghold” (Which it was I was the college topper in OS, but I did it 2 years
back)
He asked me to code the consumer/producer problem. I coded it. It was correct. But, I think he
didn’t know the code himself as he himself said that he had done it long back, so he kept the
paper (maybe to check it afterward).
He then asked me “you must know the implementation of LRU, implement it with TTL (Time to
Live)”
I didn’t even know the implementation of LRU, I tried to come up with an algorithm. He
emphasized that I should use queue, I am on the right track. I gave him a working algorithm, but
it seemed he didn’t like it, so he wasn’t ready to listen.
Turns out, after the interview, I checked there is no algorithm of LRU with queue. It can
only be done with a doubly linked list.
(I asked GPT, It created an algorithm with a queue). But it was using queue.erase (Which isn’t a
function neither in cpp, nor in python). The interview had GPT open on his laptop, I saw that. I
think GPT might have confused him.
I tried my best, even though there isn’t an algo possible with queue, I still somehow made it
work. But he just didn’t want to hear that algorithm.
We moved forward, he asked me What is a splice Fn? (Never heard about it in my life)
He was reading the resume, he said your guys' resumes are even better than mine.
He asked me do you know what error 504 is?" Error 204.
I told him I have never faced 504 while working. I have faced 404 Not found, 200 Ok, 500
Internal Server Error.
Then he asked some HR QNS
How do I deal with failure?
1-2 more.
Yeah, that's all!