# Goldman Sachs Internship Interview Experience 2021

- Status: Current ECE student at top tier NIT in India.
- Date: August 2021
- It was an on-campus Offer

** Round 1(Online Assessment Test on HackerRank – 135 minutes): **The test has 5 sections and the duration is 2 hours 15 minutes. All sections are mandatory.

- The Coding section has 2 programming questions and the duration is 30 mins.
- The Computer Science multiple-choice section has 7 MCQs and the duration is 20 mins.
- The Quantitative Aptitude multiple-choice section has 8 MCQs and the duration is 25 mins.
- Each MCQ earns you 5 marks for correct answer and -2 for incorrect answer.
- The Advanced Programming section has 1 programming question and the duration is 45 mins.
- The Subjective section has 2 questions and the duration is 15 mins. It contains value-based HR questions.
- My questions in Section 1 were:-
- CS MCQs were from OS, DBMS, OOPS in Java.
- Quantitative Aptitude contains questions from PnC, Probability, and Matrix.
- The advanced coding question was based on Backtracking similar to this https://leetcode.com/problems/word-search-ii/ (Similar to this we need to return coordinates)
- Along with coding questions you need to have a good MCQ score also to get shortlisted.

** Round 2(Technical Interview 1 – 35 minutes): **The Interviewer asked me to introduce myself for 5 minutes.

- Then he gave me a problem: Check if a string is even length palindrome or not. I told him the basic 2 pointers approach. Then he modified the question and told me that the string is too long and it’s kind of a character stream. So I can’t get the length of it. I told him about a stack approach. We will push the character in a stack and will compare it with the top every time a character comes. If the character matches then pop from the stack and store it in another stack (in case of duplicates) and in the end if the stack is empty and the stream is ended then we can return true. You can dry run this approach on “abbssbba” to get a better understanding of my approach.
- Then he gave me a math equation to solve:- a! = b! * c!. He asked me to find the number of pairs satisfying this equation such that a, b, c > 1. I tried on a few numbers from 1 – 10 and I found the pattern. We cannot generate a prime number in a! so any one of b and c has to be a previous prime number of a and the remaining part has to be a perfect factorial. He was satisfied and told me if I had any questions for him. Now at this time you can ask some smart questions and show that you are interested in working at that company.

__Round 3(Technical Interview 2 – 25 minutes):__

- This was a pretty straightforward round with no introduction and nothing he directly gave me problems. A lot of problems were asked to me in very little time.
- https://math.stackexchange.com/questions/707965/balls-and-bins-problem-expected-number-of-balls-needed-to-throw (He gave me this question and asked what is probability and what is a geometric random variable)
- I told him to ask DSA questions as I have not prepared for probability. He gave me this question. https://www.geeksforgeeks.org/design-and-implement-special-stack-data-structure/
- Then he gave me a Matrix problem https://www.geeksforgeeks.org/maximum-path-sum-matrix/
- Then he gave me puzzles:
- There are 4 types of socks in a drawer. How many minimum socks to grab so that you have 1 pair for sure?. Pretty easy one. Ans – 5.
- You and your friends are playing a game. There are 21 cards and you have alternate turns. You can pick 1, 2, or 3 cards at a time. One who picks the last card wins. You start first, how many cards should you pick so that you will always win. Both players play optimally. Ans – In this question, we can see a pattern if we start from 4, 5, 6, … We can see that when cards are multiple of 4 I will always lose. So if I pick 1 and 20 cards are remaining so that my opponent will always lose as it is a multiple of 4.

- At last, he asked me if I’ll try a probability puzzle or not. He gave me this puzzle. https://www.geeksforgeeks.org/birthday-paradox/

** Round 4(HR + Technical – 45 minutes): **It started with a brief introduction of him and later he asked me to introduce myself.

- He then took my resume and started asking questions related to projects and POR.
- Then he gave me some probability question. https://www.quora.com/How-do-you-decide-the-winner-among-3-people-with-an-equal-probability-by-tossing-a-fair-coin I told him I’ll toss the coin 3 times. He was satisfied but he said it’s possible in less than 3 also. He told me how but it went over my head.
- Then he gave me an array question where each element represents either 1 or 0. In 1 operation, from any index I we can switch all the values till the end. Find minimum operations to make all elements in the array equal to 1. He asked me to code this time. My approach was to start from the back and count the mismatches (01 or 10). He tried in a few cases it was working.
- https://www.geeksforgeeks.org/stock-buy-sell/
- At last, he gave me this puzzle https://www.geeksforgeeks.org/puzzle-16-100-doors/ At first I told him a sieve kind of solution then he told me to look for a pattern in this and I found it using factorization.

** Round 5(Kind of Design – 30 minutes): **First he introduced himself and told me what we do at Goldman Sachs.

- He asked me theory questions this time.
- Why does the array have constant access?
- Array vs LinkedList
- Implement Hashmap
- Collision handling techniques

- He gave me this question https://www.geeksforgeeks.org/queue-using-stacks/ (By making enQueue operation costly). He also asked me to code this. I took 15 minutes to code it as I was very tired. This was my 4th interview of the day. He also understood it and said take your time.
- At last, he told me you have given 2 files, one contains all the ids of our clients and the other contains transactions. The transaction file is too large. He asked me to calculate the sum of the amount in all transactions for a particular client and for every client, I told him I’ll use a map. He further introduced threading in this. He said we can divide this large file into 4 threads and can do it. Then he asked me what would be the problem with this. I told him there might be a race condition. He asked how I resolved it. I told him we can use semaphores or mutex. He stopped here and asked me if I had any questions. You know now what to do here.

The results were out in a few hours and I was Selected.