# Goldman Sachs Interview (for Experienced)

Interview was same for all the IITs.

Rounds may vary from 7 to 12 rounds based on the position you apply for

**Round 1: HackerRank Test – 90 min**

1: Find the total lattice points on circumference of circle.

Ref: https://www.geeksforgeeks.org/circle-lattice-points/

2. Given a matrix of positive integers/points. We have to start from lower left corner and reach the upper right corner. Our path should be such that we fetch maximum points. Only two movements are allowed- up and right, i.e. from a cell (R, C), you can either go to (R, C+1) or (R-1, C).

Note: To qualify for next round both questions need to be solved.

**Round 2:(Design)**

Design questions:

1. Design Snake And Ladder Game.

Algorithms: Given circular linked list, detect loop in it.

Ref: https://www.geeksforgeeks.org/detect-and-remove-loop-in-a-linked-list/

2. Min flip to make binary string alternate.

Ref: https://www.geeksforgeeks.org/number-flips-make-binary-string-alternate/

The third was a string implementation based question.

**Round 3:(Tech-1)**

1. It started with the introduction of myself and the work I was doing in my current organisation. Then some discussion on it particularly involving REST services. Then they made me write an HTTP GET method for a situation in an efficient way.

2. Implement queue using Stacks. First I solved it using two different stacks.

3. Then they asked me to implement the queue using only 1 stack.https://www.geeksforgeeks.org/queue-using-stacks/

4. What is a Binary Search Tree?

5. Write a program to check whether a binary tree is BST or not.

https://www.geeksforgeeks.org/a-program-to-check-if-a-binary-tree-is-bst-or-not/

6. What is JDK, JRE, JVM? Then some more questions on the answers I gave.

7. Given a matrix containing only 0’s and 1’s. Each row will have some number of consecutive 0’s followed by some number of consecutive 1’s. We have to find the row containing maximum 0’s and also the number of 0’s in that row. At first, I suggested implementing Binary Search on every row to find the number of zeroes and then comparing the number of zeroes for every row. The interviewers said it is right but they wanted something better. Then I suggested implementing Binary Search on first row, store the index containing last 0 and then moving down in the matrix on that index. If you encounter a 1, then you can safely ignore that row. If you get a 0, then you can implement Binary Search on that row and update your stored values. The interviewers were satisfied with this solution.

8. Differences between Arrays and Linked Lists. In which situation, you would choose one over the other?

**Round 4:(Tech-2)**

1. What is operator overloading? Write a code depicting implementation of Operator Overloading.

2. Write an operator overloading method for + operator on strings, which concatenates the first string with the reverse of second string.

Ex- String1- app String2- le Then String3 = String1 + String2 = appel.

After I wrote the method, they asked me to optimise my method. So i suggested a faster reverse of the second string.

3. Write a method to test the above code. They wanted me to write a neat test code which is understandable to other person who does not know anything about my original code.

4. Different testing concepts. What is unit testing, integration testing, regression testing? What is the need for each one of them?

5. The testing discussion lead to environments discussion. I mentioned production and test environments in my answers. So they started discussing the need for so many environments for a same application.

6. If we give you a particular feature to add to an application, how will you do it? How will you document it, test it? How will you take it through different environments of the application?

**Round 5:(Tech-3)**

1.Then asked a question where given brackets, parenthesis, and/or curly braces, see if it is valid. Like {]}{})(, {}()[()]. The first one would be false, the second one would be true. The interviewer really looked for when I would get stuck, and tried to see how I would react when I didn’t know something. He liked the part when I got stuck, and when I was able to find my way back to the solution.

2.In a client-server architecture, there are multiple requests from multiple clients to the server. The server should maintain the response times of all the requests in the previous hour. What data structure and algo will be used for this? Also, the average response time needs to be maintained and has to be retrieved in O(1).

**Round 6:(Tech-4)**

1.Find minimum element in stack. Optimized solution is required.

2.Delete a node in BST.

3.Intersection point of two linked list.

4.Check if a linked list is palindrome or not

5.Concept of OOPS : Encapsulation, Data Hiding, Abstraction, Polymorphism etc.

Mutex vs Semaphore

Threads in General

**Round 7:(Algorithms)**

1>https://www.geeksforgeeks.org/largest-sum-contiguous-subarray/

2.Given a list of transaction between friends who have to give or take some amount of money from one another. Now, they have to settle up with minimum number of transactions. Also, you have return a list of all the transactions. For example – If B owes A Rs. 200 : B->A = 200. Similarly, if C owes B Rs. 200 : C->B= 200. So the minimum number of transactions is 1 and that should be : C->A = Rs. 200

**Round 8:(Tech-5)**

We were given a 2 page code the purpose of which was to merge sort a linked list while removing duplicates and we had to point out errors in the CORE LOGIC of the program and not give silly errors like semi-colons or de-referencing pointers. I think I found about 4 or 5 good errors in the code. 7 people were selected for the 2nd round. In my interview, the first question was, given a ternary operator string, for example, a?b?c:d:e, we had to convert it into a tree form.

https://www.geeksforgeeks.org/convert-ternary-expression-binary-tree/

It took me some time to do this problem, around 25-30 mins including writing the code. The interviewer was impressed and asked me a second question which was based on dynamic programming.

https://www.interviewbit.com/problems/ways-to-decode/

**Round 9:(Tech-6)**

1.We were given a 2 page code the purpose of which was to merge sort a linked list while removing duplicates and we had to point out errors in the CORE LOGIC of the program and not give silly errors like semi-colons or de-referencing pointers. I think I found about 4 or 5 good errors in the code. 7 people were selected for the 2nd round. In my interview, the first question was, given a ternary operator string, for example, a?b?c:d:e, we had to convert it into a tree form.

https://www.geeksforgeeks.org/convert-ternary-expression-binary-tree/

2.It took me some time to do this problem, around 25-30 mins including writing the code. The interviewer was impressed and asked me a second question which was based on dynamic programming.

https://www.interviewbit.com/problems/ways-to-decode/

**Round 10:(Tech-7)**

1.Trapping Rain Water

2.Next Smaller Number/ Next Greater Permutation

3.Maximum distance between 2 nodes in an n-ary tree

2) Given a tree with edge weights, find any path in the tree with maximum sum of edges.

3) Given a maze, a start point and end point find the shortest path to reach the end point from the starting point.

**Round 11: (Director’s round)**

To start with, he asked me thoroughly about my current work and what things I am working upon. We had discussion for around 30 minutes on my work exp.

Then, he asked me to implement stack. I did it using an arraylist. Cross questioning on this happened for 10 minutes.

After that he gave me a puzzle: Suppose you and me are playing a game on a round table and we both have infinite number of coins. The rules are as follows:

• It is a turn-based game, so you and me take turns alternatively (1 coin per turn)

• We have to place the coin on the table and coins cannot be put on top of each other.

• Coins may not be moved once put on the table.

• if there isn’t any room to put coins on the table, the person who placed the last possible coin wins.

**Round 12:(HR round)**

1) What do you know about Goldman Sachs?why do you want to join?

2) Normal HR level questions.

3) Questions about how do you organize an event/piece of work this in TOP bank sector.

Hey geek! It’s time to become a success story instead of reading them. Check out our most renowned **DSA Self Paced Course**, now at a student-friendly price and become industry ready. And if you are looking for a more complete interview preparation resource, check out **Complete Interview Preparation Course**** **that will prepare you for the SDE role of your dreams!

Feeling prepared enough for your interview? Test your skills with our **Test Series** that will help you prepare for top companies like **Amazon, Microsoft, TCS, Wipro, Google** and many more!