Goldman Sachs Interview Experience | For 1.5+ Years Experienced
I got the interview call from GS HR (via Naukri or Some other job portal). The process had 9 rounds, all technical, which took around 2 months to complete. My profile was Analyst and role – java developer.
Round 1 (HackerRank – Online):
2 coding questions asked – 1 easy, 1 medium.
Duration : 90 min
- Given a range of numbers [x, y] and an integer q. Multiply all the numbers in the range by q and return the count of all the numbers which have no same digits as the corresponding product obtained.
Ex- If x=10, y=12, q=2. Then the products corresponding to 10, 11, 12 are 20, 22, 24.
The count will be 1 as only 22 has all different digits than 11.
- 0/1 Knapsack problem. One more addition being that you had to tell which all items were chosen for the optimal solution. https://www.geeksforgeeks.org/printing-items-01-knapsack/
I did both but I think 1 ques is also sufficient for next call.
Round 2 (Coderpad 1- Telephonic):
About coderpad – its an online tool where the screen is shared between you and your interviewer and you have to run and debug your code.
2 coding ques – 1 easy, 1 medium.
Duration : 60 min
- There are some students, sitting in a circle. Each student is assigned a roll no (1 to n). There is a teacher who was given an initial roll no and he has to remove the student with initial roll no. and then has to remove the student who was at that position starting from the removed student. Your function should return the last student left.
Example: 2, 3, 1, 4, 5 start with 3, remove 3, then remove 5, then remove 1 (follow circle), then remove 4. Ans – 2. Problem is similar to https://www.geeksforgeeks.org/josephus-problem-set-1-a-on-solution/
- Given a list of students with their scores in different subjects find the student with a max average score.
I did both the ques. You have to pass all the test cases. The interviewer was keen to know the thought process and also your debugging skills.
Round 3 (Coderpad 2- Telephonic):
All constraints were same as the above round. This time the interviewer was from Newyork.
- Median of two sorted arrays (without extra space). Link – https://www.geeksforgeeks.org/median-two-sorted-arrays-different-sizes-ologminn-m/
- Given a log file, each line begins with some IP address, find the most frequent IP address.
Did both ques.
Tips for coderpad rounds :
- Keep talking to your interviewer so that he can help you whenever you are stuck.
- He can throw new test cases, extension of problem or can ask to optimize the code. Be prepared for that.
- It’s okay to take some extra time, I took almost 10 min extra and interviewer was fine with that, but you have to pass all the test cases.
- Be calm if your code doesn’t run at first attempt. Just debug it using usual techniques.
- As per my experience, once you crack these rounds, it’s little easier to crack the others.
Round 4 (Telephonic):
This round was the easiest of all. 4 ques. 60 min.
- Given an array of pos and neg integers, return the element, removing which the product of the remaining elements is maximum.
- Check if a binary tree is balanced. Optimize it for O(n). Link – https://www.geeksforgeeks.org/how-to-determine-if-a-binary-tree-is-balanced/
- How does hashmap work? What happens if you don’t override equals and hashcode methods for custom class?
- Given 2 strings, check if one string contains another as a substring. Link – https://www.geeksforgeeks.org/check-string-substring-another/
I had to write codes for ques – 1, 2 and 4 and then recite them line by line (It’s funny I know).
Next 5 rounds were onsite rounds, each round was taken by 2 interviewers, 60-75 min duration.
Round 5 (F2F):
- There are 50 million users accessing Goldman website how will you reduce manual support i.e. how will you automate the support system? Then some follow up ques.
- Project discussion – 30 min (They were very smart people and I really enjoyed this discussion with them)
- Given an array, find the largest decreasing subarray. Write the code for it. Now the array is circular, modify your code for that. Time complexity discussion. Similar to – https://www.geeksforgeeks.org/longest-increasing-subarray/
- Given a stack, find the max element in O(1) with minimum space complexity. Link – https://www.geeksforgeeks.org/design-a-stack-that-supports-getmin-in-o1-time-and-o1-extra-space/
Round 6 (F2F):
This round was taken by 2 senior people (One of them is my manager now :P)
- If you are writing a custom class and want to implement hashmap for it, what things you will take care of?
- There is an employee class, how will you write hashcode and equals method for that?
- If you want to get employee details corresponding to emp id, how will you store it? Now if you want data corresponding to emp name how will you do it? Now you want both functionalities, give some optimized technique. Some more follow up ques.
- Implement a custom iterator in java – there is a list of list (List<List<Integer>>). Write both – hasNext() and next() methods in such a way that hasNext() method should return true if the next list in the main list has some element present and next() method should return that element. Example: list – [[1, 2, 3], [4, 5], [6, 7]] then your custom iterator’s next() should return 4 after 3 and 6 after 5. Similarly, hasNext() will return false only at 7. I had to write the production level code.
- Why GS?
Round 7 (F2F):
- Given an utterance with misplaced spaces in between words. e.g. “I am an Indian” will look like – “Iam anI ndian”. You have to find out how will you derive correct utterance out of it. You are only given a dictionary of all possible English words. He was only interested in my approach to the problem.
- Design typeahead (Search autocomplete)
- Given the postorder of a tree, how will you get inorder from it? I said there could be multiple possibilities then he asked how many?
- Given an expression containing brackets, find if it’s valid. Write code. Link – https://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/
Round 8 (F2F):
- Given a UI of the company portal, how would you store and show the hierarchy of employees? I gave a solution using tree and some DB in the backend. But she was not interested in DB. Then I gave a solution using cache and DB. They asked DB queries then.
- Given a document, how would you find the first non-repeating word? Now if the file size is 50 GB, how would you do it? (Use multiple cores)
- Why do you want to switch?
- Given a histogram on UI, you have to send data from the backend, data could represent anything e.g. population of cities or density of different fluids, etc. How would you send such information? You can’t do any hard coding, since you have to keep the application generic. I gave hashmap solution, then she asked me that your histogram’s bars are also divided and they represent some more granular level information, e.g. area wise population of cities. How will you enhance your application?
Round 9 (F2F):
- How do you solve “out of memory exception” on production?
- What issues did you face on your production, how did you debug them?
- How did you use spring in your project?
- Write a code to depict Spring API. Then I wrote Get API code with all the annotations.
- Does parameter inside @RequestParam annotation is mandatory?
- Can we use anything else in place of @RequestParam? Some more questions and discussion.
- What is bean?
- What is dependency injection, write code to depict DI.
- What is IOC?
- What is autowiring? Write code for it.
- You have a Car showroom, if a new car launches how would you design the system, so that mininum changes required for that car addition?
- Abstract class vs interface – some more discussion on OOPS.
- Given a tree, write a code for vertical order traversal. Link – https://www.geeksforgeeks.org/print-binary-tree-vertical-order-set-2/
I observed below things during my interview process –
- They are not looking for candidates who can give all answers flawlessly. When I was asked about “out of memory exception on production”, I was completely blank. I gave some unsatisfactory answers but then she moved on and asked me about how I debug when face issues on production. I told her few scenarios and she was satisfied. But yes, your programming skills should be up to the mark.
- Be prepared for behavioral questions. They check if the person fits into their culture. Also, communication skills matter.
- According to me the major focus areas were (for my experience level) : PS-DS-Algo > Language understanding (be it java or any other) > System design = Current project understanding > Resume based questions and testing/debugging skills.
- All the interviewers were very supportive and smart. It was overall a good experience.
My preparation resources – geeksforgeeks, cracking the coding interview, OCA/OCP Java SE 7 Programmer I & II Study Guide
In my case, they immediately told me that I was selected but generally it takes few days. It takes 1-3 weeks for the offer letter to be processed.
Feel free to drop your mail id in comments in case you need referrals in future 🙂 All the best!
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.