# Goldman Sachs Interview Experience | Set 24 (On-Campus )

Following are the details of my interview with Goldman Sachs.

Round 1: Online Coding Round conducted on Hackerrank (1.5 hours)
The online test was of 100 points
It comprised 5 MCQs of 10 points each, with penalty of 3 point each for wrong answer.
There were 2 coding questions of 15 and 35 points respectively.

First Coding Question –
Given a sentence, find the even length word of maximum length. In case of a tie, find the word which occurs earlier in the sentence. In case no such word exists, print “00”.
Second Coding Question –
A greedy question almost similar to this question.

21 students were shortlisted after this round.

Round 2: F2F Technical Round 1 (30 minutes)

1. Discussion on the projects and the technologies used in implementing those
2. Questions related to OOPS – Inheritance, Garbage collection in JAVA, Virtual functions in C++
3. HashTable Vs HashMap, Static Scope, Local Scope, Diamond Problem
4. Linear Probing Vs Quadratic Probing, Run Time Polymorphism
5. Implement a Library System
6. References Vs Pointers, Why do we need references when we have pointers?
7. Reverse the linked list using both recursive as well as iterative way.
8. Delete a node from a BST
9. Search an element in an infinite sorted array with minimum possible complexity
10. Implement stack in such a way that it always acts as a min-stack
11. Several Moral Questions where I was provided certain situations, and how I would have tackled them
12. Why GS?

11 students were shortlisted for the next round.

Round 3: F2F Technical Round 2 (1 hour 15 minutes)

1. I was asked an algorithmic question as follows-
You are provided a sentence, and several queries.
Queries will be the following type – (Word 1, Word 2). For the given pair of words, find the minimum difference between their starting indices in the given sentence. Case sensitivity must not be taken into consideration.
For example – If the sentence is “I like rabbits and rats. Rabbits are cute.”
Query – (“rabbits”, “rats”).
Now there are 2 possible combinations of this pair. Find the minimum possible difference.

Approach
Make a vector corresponding to each of the word present, which shall store its occurrences in the increasing order in the sentence.
Now, whenever a query is input, choose the vector corresponding to the word which has less number of elements.
Let the two vectors be A and B respectively ( Size of A <= Size of B )
Traverse the vector A, and for each of the element, find the value just smaller to it, and the value just larger than it in vector B.
This can easily be carried out using Binary Search. Find minimum difference over the entire traversal of vector A.

The interviewer carried out dry run on my solution, and checked it on several corner cases. He was satisfied with my solution.

2. Second question was related to BST.
You are provided a BST, which is corrupted. One of the nodes in it has 2 parents. Let’s say those are parent 1 and parent 2. It is ensured that none of these parents will be the ancestor of the other. Identify the node, and remove the link of the wrong parent.

Approach-
Identify the node which has 2 parents by making use of some visited array.
Now, find LCA of both the parents.
The value of LCA shall tell us if the corrupted node should lie on its left or on its right.
By this, we can remove the link of the wrong parent.

3. Several puzzles. Most of them were from here.
4. OS Questions- LRU Cache, Banker’s Algorithm, Semaphore vs Mutex
5. DBMS Questions- Transactions, ACID Properties, Several SQL Queries like GROUP BY, ORDER BY,
Aggregate functions, Views Vs Tables, Triggers, Joins

Round 4: HR Round (25 minutes)

1. Discussion with respect to my resume
2. Discussion regarding my JEE Rank and Board Score
3. State atleast 5 reasons why we should hire you
4. State atleast 3 reasons why Goldman Sachs is better than the company where I had an intern
5. Brief discussion regarding my role as Teaching Assistant in Algorithms Course for Juniors

Thanks Geeksforgeeks for being a perfect platform for practice. 🙂

This article is contributed by Shivam Garg (shivam_isc) . If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org

My Personal Notes arrow_drop_up