SLB Interview Experience — SWE New grad

Akash Kumar
2 min readJan 28, 2024

At my university’s career fair, I found an opportunity with Schlumberger (SLB). They use a third-party service called KARAT for conducting their screening rounds.

KARAT Technical Round:

3 coding question + 3 MCQ were there and time limit was 50 minutes around :

MCQ : Don’t remember

Coding :

Suppose we have some input data describing a graph of relationships between parents and children over multiple generations. The data is formatted as a list of (parent, child) pairs, where each individual is assigned a unique positive integer identifier.

For example, in this diagram, 6 and 8 have common ancestors of 4 and 14.

15
/ \
14 13 21
| |
1 2 4 12
\ / / | \ /
3 5 8 9
\ / \ \
6 7 11

pairs = [
(1, 3), (2, 3), (3, 6), (5, 6), (5, 7), (4, 5),
(15, 21), (4, 8), (4, 9), (9, 11), (14, 4), (13, 12),
(12, 9), (15, 13)
]


1. Write a function that takes this data and the identifiers of two individuals
as inputs and returns true if and only if they share at least one ancestor.

Sample input and output:
hasCommonAncestor(pairs, 3, 8) => false
hasCommonAncestor(pairs, 5, 8) => true
hasCommonAncestor(pairs, 6, 8) => true
hasCommonAncestor(pairs, 6, 9) => true
hasCommonAncestor(pairs, 1, 3) => false
hasCommonAncestor(pairs, 3, 1) => false
hasCommonAncestor(pairs, 7, 11) => true
hasCommonAncestor(pairs, 6, 5) => true
hasCommonAncestor(pairs, 5, 6) => true
hasCommonAncestor(pairs, 3, 6) => true
hasCommonAncestor(pairs, 21, 11) => true

n: number of pairs in the input

2. Nodes with 1 parent and nodes with 0 parents.

Sample output:
Node with 1 parent : 4, 13 , 21, 7, 11, 8, 5

Node with 0 parent : 1, 2, 14, 15


3. Earliest ancestor of a any given node.

Sample input and output:
EarliestAncestor( 8 ) => 14
EarliestAncestor( 14 ) => -1
EarliestAncestor( 6 ) => 14

Result : Ghosted

--

--