About SLB Karat Interview

The interview lasted about an hour, the first 10 minutes were spent introducing myself, and then I was asked three yes or no questions.
The first one was space and time complexity (I don’t remember the question).
The second question was binary search time and space complexity (I encountered recursive writing with system space stack overhead).
The third question was bubble sort, written recursively. The answer is no, base case is not length 1, but <
Next is coding, the first question is given an array that looks like this
[(5,6),(1,3),(2,3),(3,6),(15,12),(5,7),(4,5),(4,9),(9,12),(30,16)]

image
Then it asks you to return an array of nodes with only one parent node and an array of nodes with no parent node.

[
[5,7,9,16], [1,2,4,15,30].
[1,2,4,15,30]
]

The second question is a combination of this + leetcode 236 LCA to find the common nearest ancestor. If you can’t find it, return fals‍‍‍‍‍‍‍ ‍‍‍‍‍‍‍‍ e, return true if found

1 Like