Interview Experience Goldman Sachs | Analyst | Coderpad round
Summary
I had a Coderpad round for an Analyst position at Goldman Sachs where I was able to solve two algorithmic questions, though I received some hints on the second one. The verdict is still pending.
Full Experience
I joined the Coderpad round for an Analyst position at Goldman Sachs. The interviewer started right on time with introductions. I was asked two specific questions. I managed to solve both of them. For the second question, the interviewer provided a couple of hints when I was heading in the wrong direction, which I thankfully picked up and used to solve the problem. I am currently awaiting the final verdict.
Interview Questions (2)
Given a string, find all the unique substrings of a specified length 'len'. As a follow-up, I was asked to handle multiple edge cases through exception handling.
Given a forest (one or more disconnected trees), find the root of the largest tree and return its Id. If there are multiple such roots, return the smallest Id among them. I was provided with a map immediateParent, containing key-value pairs indicating child -> parent relationship. The key is the child and the value is its 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).
Input:
{ { 1 -> 2 }, { 3 -> 4 } }Expected output:
2