Round 1:
OA: 100 mins test
Round 2:
Question1:
You are given a 2D plane, there are points, every point is represented by [x, y], you need find all distinct rectangles which are either parallel x axis or y axis.
Example:
points=[(1,1),(1,4),(4,1),(4,4),(2,2),(3,3)]
Solution: 1.
(1,1),(1,4),(4,1),(4,4)
y-axis
^
| (1,4) (4,4)
| *-------------*
| | |
| | |
| | |
| *-------------*
| (1,1) (4,1)
|
+----------------------------------> x-axisI could not propose a better solution than O (N^2), any pointer for a better solution.
Question2:
Given a binary tree, find the maximum path sum when you are allowed to skip 1 value.
-10
/ \
9 20
\ / \
-100 15 7Answer 44.
Maximum Path: 9-> -10 -> 20 -> 15
not able to code this due to time.