Panda Guru LogoPanda
Guru

SDE 2 | DP World- Gurgaon | Rejected

Round 1

Questions:


Round 2

Questions:

  1. You are given a 2D plane, there are points, every point is represented by [x, y]. You need to find all distinct rectangles which are either parallel to the x-axis or y-axis.

    • Example:
      points = [(1,1),(1,4),(4,1),(4,4),(2,2),(3,3)]
      
    • Solution:
      y-axis ^ | (1,4) (4,4) | *-------------* | | | | | | | | | | *-------------* | (1,1) (4,1) | +----------------------------------> x-axis
    • The candidate could not propose a better solution than O(N^2) and asked for pointers for a better solution.
  2. Given a binary tree, find the maximum path sum when you are allowed to skip 1 value.

    -10 / \ 9 20 \ / \ -100 15 7
    • Answer: 44. Maximum Path: 9 -> -10 -> 20 -> 15.
    • The candidate was not able to code this due to time constraints.
Candidate's Approach

For the first question, the candidate acknowledged the challenge of finding a better solution than O(N^2) for identifying distinct rectangles from the given points. They were open to suggestions for optimization.

For the second question, the candidate recognized the maximum path sum but could not implement the solution within the time limit.

Interviewer's Feedback

No feedback provided.