Interview Experience Goldman Sachs | Analyst | Coderpad round
Anonymous User
1236

Interviewer joined on time and started with introduction.
I was aksed two questions:

Given a string, find all the unique substrings of length 'len'.
As a follow up interviewer asked to handle multiple edge cases through exception handling.

Given a forest ( one or more disconnected trees ), find the root of largest tree and return its Id. If there are multiple such roots, return the smallest Id of them.
Given a map immediateParent, containing key-value pair indicating
child -> parent relationship. The key is child and value is the corresponding immediate parent.
Constraints

Child cannot have more than one immediate parent.
Parent can have more than one immediate child.
The given key-value pair forms a well-formed forest ( a tree of n nodes will have n-1 edges )
Example:
Input:
{ { 1 -> 2 }, { 3 -> 4 } }

Expected output: 2

Was able to solve both questions. However interviewer gave couple of hints in second question when he thought i am taking wrong approach. I was able to pick the hint and solved both.

Verdict: Yet to be declared.

P.S. Selected for next rounds.

Comments (1)