Goldman Sachs Interview Experience | On-Campus Internship
There was an online test on hackerrank platform which comprised of Coding and Quants(Probability and General Maths mostly) section.
- Coding Question 1: You’re given a DFA: number of states, starting state, accepting states list, it’s transition table. How many strings of length l can be accepted by it?
- Coding Question 2: It was modified Camel Banana Puzzle(https://www.geeksforgeeks.org/puzzle-15-camel-and-banana-puzzle/). In the original puzzle, the camel needs a banana to move. In this question, camel eats a banana if it’s carrying some but it can move even if it carries no banana at all.
- Coding Question 3(Advanced): I don’t remember the problem well. There were 4 friends in a 2D matrix, each can move in any of the 4 directions(N, S, E, W). Given their initial coordinates, find the point where they should meet such that some of the distance covered by each of them is minimized.
- Coding Puzzles(I remember only these):
- What’s the output of this snippet: https://ide.geeksforgeeks.org/nS7QOeQcUv ? Compile time error, runtime error, rubbish?
- Suppose a const int pointer is initialized with value 6 in C++. Can you ++ it? If yes, what’ll be its output when you try to access it: 7 or some garbage value?
- Quants MCQ(I remember only these):
- a+b+c+d = 63. What’s max(a*b+b*c+c*d)? All are naturals(Ans is 991)
- You keep on throwing a dice and add the digit that appears to a sum. You stop when sum >= 100. What’s the most frequently appearing digit in all such cases? 1 or 6 ?
- Sum of two tan inv numbers (https://www.emathzone.com/tutorials/math-results-and-formulas/formulas-for-sum-and-difference-of-inverse-trigonometric-functions.html)
- Simple integral of an expression (involving sin(x), cos(x))
- Two subjective questions. What’s the biggest challenge ever faced in your life? What’s the most difficult feat that you’ve achieved in your life?
First few minutes we both formally introduced ourselves. Then the interviewer asked to discuss the project I’m most comfortable with. Then asked how to mirror a tree(https://www.geeksforgeeks.org/write-an-efficient-c-function-to-convert-a-tree-into-its-mirror-tree/). Then asked how to optimize it further(saying there were a million nodes in the tree). I responded that I cannot think of any other way. Then I was hinted to use parallelization. I told to use ThreadpoolExecutor in Java, but the interviewer insisted on a C++ based solution using fork(). I couldn’t come up with a solution.
Firstly formal introduction. Then discussion about my projects. Then the interviewer asked me a standard question (https://www.geeksforgeeks.org/find-pythagorean-triplet-in-an-unsorted-array/). I came up with an O(n^2*logn) solution but the interviewer wanted a better answer. I was provided hints and finally, I came up with an O(n^2) solution. Then asked me what’s the limit of the ratio of two Fibonacci numbers (https://www.quora.com/How-is-the-golden-ratio-related-to-Fibonacci-numbers/answer/Gary-Meisner). I knew the derivation already so I told about the golden ratio and derived it.
I didn’t have any HR round. It seemed that interviewers were asking the same set of questions to every candidate they were interviewing. I was selected on the extended list.
Food for thought:
An interviewer was asking really good maths related questions, and none of the candidates answered all of them. I didn’t have an interview with that interviewer, but I really liked the problem. You choose 10 numbers randomly from 1 to 100(inclusive). Then prove that you can always choose two subsets from those 10 elements such that their sum is equal. (Hint: use pigeonhole principle)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon. Google and Microsoft Test Serieses.