Open In App

Goldman Sachs Interview Experience (Software Engineer – Experienced)

Improve
Improve
Like Article
Like
Save
Share
Report

I contacted the recruiter through LinkedIn and share my resume with them. Within 2 days, he sent me the test link. At that time I was having 1 year of experience as an Application Developer.
Round 1: Hackerrank Test
Duration: 1.5 hour
Number of Questions to be solved: 2

  • Question 1: Easy DP (Related to nth Stair Code, but a bit modification and extension of this question)
    link: Count ways to reach the nth stair
  • Question 2: Medium (Don’t remember the question)Solved both of the questions.

Round 2: Coderpad Round
Duration: 1 hour
Number of Questions to be solved: 2

  • Question 1: String Implementation Question (Easy-Medium)
  • Question 2: Print recurrent digits in braces. Slight Modification to this Ques: https://www.geeksforgeeks.org/find-recurring-sequence-fraction/Example:
    Input: a=1, b=3 
    Output: 0.(3)
    
    Input: a=2, b=5
    Output: 0.4
    
    Input: a=1, b=6
    Output: 0.1(6)
  • I solved the first question fully and in 2nd one, only corner cases were missing (Due to tight time-bound).

Round 3: Coderpad Round
Duration: 1 hour
Number of Questions to be solved: 2

  • Question 1: Design a class in Java which implements the Deque interface. (i.e. Implement your own Double Ended Queue in Java without using any collections)7 methods to be implemented: addFirst(), addLast(), removeFirst(), removeLast(), peekFirst(), peekLast(), size()
  • Question 2: In 2D matrix, the gold coin is given in each cell. From the bottom left corner, you have to reach the top right corner by collecting the maximum points. (Similar to this: Maximum sum path in a matrix from top to bottom)
  • After this round, there were 2 Video Conf round (Back to back for 2 hours).

Round 4: Video Conf Round
Duration: 1 hour (1st Video Conference round)
Work Experience & Project Discussion. (Be prepared to face in-depth questions, why you prefer this over that type of questions )

Immutable classes in Java. Started with basic details on how to make any class immutable.
After that they gave some scenarios like the class contains ArrayList, hence when getter for that is called, if we return the ArrayList as is, it will violate the concept of Immutability, as the elements inside the ArrayList can be modified.

  • Question 1: House Robber Question link: https://leetcode.com/problems/house-robber/
  • Question 2: Print boundary Traversal of a Treelink: Boundary Traversal of binary tree

One Core Java Question to check understanding of what is bind at compile time vs runtime




class A {
    int temp = 10;
    public void print()
    {
        System.out.println("In Class A");
    }
}
class B extends A {
    int temp = 20;
    public void print()
    {
        System.out.println("In Class B");
    }
}
class C {
    public static void main(String args[])
    {
        A a = new B();
        System.out.println(a.temp);
        a.print();
    }
}


Hint: Variables are bind at compile-time, hence they don’t have anything to do with run-time polymorphism.

Round 5: Video Conf Round

Duration: 1 hour (2nd Video Conference round)
Work Experience & Project Discussion.

  • Explain how you’re using SDLC in your organization. (In-depth answer required).
  • They want to know how code-reviews and code-merge is done. How build and release is maintained. What’s the development model you’re following (In my case it was incremental model)What are the testing mechanisms? How JUnits, Regression Testing, and Load/Performance testing is done,
  • How the customer is getting the upcoming changes? (Details about release cycle)
  • How do you handle cases of regression?
  • Question 1: Left View of a Binary Tree (Most optimal solution required O(n) time and O(1) space)link: Print Left View of a Binary Tree
  • Question 2: Don’t remember this one (It was a bit difficult)

Many-Core Java Question:

  • Abstract Class vs Interface (When to use when)
  • OOPs, concepts used in your J2EE Framework (Not your project – Here they want to know how well you know Core Java concepts used behind J2EE frameworks)For Example Managed Beans follows the concept of Encapsulation. Program to an interface and not the class – Polymorphism.
  • Question on Java Collection
  • Singleton class and ways to achieve that (Deep Discussion on Early Initialization vs Late Initialization vs Bill Pugh)
  • After these rounds, I was called onsite on weekdays. (2 Flight Tickets + 4 Taxi Fare reimbursed)

These questions were common in all 3 rounds:

  • Tell me about yourself.
  • They will pick one project (Non-work-ex). They will deep dive into that, and will ask counter questions on technology used, methodology followed, etc. (Tip: Be 100% sure about what you write in your resume – As after all the rounds, almost everything from my resume was covered)
  • Work-Experience related questions. – Most favorite thing you implemented in the last 1 year- Design Pattern used in the project. (Please have at least one project in which you have used some design pattern)

Round 6: Face to Face Interview
Duration: 1.5 to 2 hours

  • Given a scenario where you have to design a suitable data structure.- I gave them approaches using HashMap and AVL Tree.- Discussion on complexity comparison between them.- Implement your own hashmap. (If you know in-depth working of hashmap, this will be very easy)
  • Based on my work experience, I was asked to write code in choice of any ORM (Hibernate/JPA/ etc)- In the code, based on some logic we have to use update and delete operations.
  • Follow up of 2nd Question. Some SQL Queries. (Easy-Medium)- This was based on SubQuery, Group by and joins4) Current Project and Framework Architecture (In the following manner)(Core Java -> JSP-Servlet -> JSF-Managed Beans)(Database -> JDBC -> Hibernate -> JPA)

Rapid Fire Round (4-5 minutes per question):

  • Height of a Tree
  • Some question on Tree which can be solved using PostOrder Traversal
  • Merge Sort vs Quick Sort (which is to be used with Arrays/LinkedLists)
  • Quick Sort (Discussion on Pivot) – Randomized Quick Sort (Only basic discussion on this)

Round 7: Face to Face Interview
Duration: 1 hour

  • What is Transfer learning (Intuition and Methodologies) (Based on my deep learning project)
  • Design a suitable data structure to play a game of Jigsaw Puzzle.- From this, some 2-D matrix questions were asked. (Rotate matrix in 90, 180, 270 degree)
  • All possible questions on Java Collections:
    1. Internal working of HashSet
    2. ArrayList vs LinkedList (In terms of usage)
    3. Hashtable vs HashMap vs ConcurrentHashMap

Round 8: Face to Face Interview (Bar Raiser Type)
Duration: 1-1.5 hours so far, this was the toughest of all.

  • 1. He directly jumped to HashMap’s internal working. He asked do you know about “Treefy Factor”?
    1. I explained it. From Java 8, this change was introduced.
    2. When the size of the linked list in any bucket exceeds some factor, the LinkedList is converted into self-balanced BST.
      Counter Questions:

    1. Given Employee class, if we don’t override hashcode() and equals(), will it work in HashMap? (Yes, Object class which is the parent of every class have hashcode() and equals())Hence it will work, but might cause some performance issue.
    2. For the same Employee class, TreeMap will work? (No -> We need to implement custom comparator)
    3. What happens to treefy factor when we use HashMap? In this case, to convert LL into BST, we need some kind of comparison logic. Hence if the comparator/comparable is not implemented it will not convert LL into BST. But, there will not be any error.
  • 2. Implement a suitable data structure for which following operations are done in O(1)
    1. insert(int element)
    2. delete (int element)
    3. getRandom() -> Return any element from Data Structure with equal probability
  • 3. Design a Bank Account in Multi-Threaded Environments. (Most Interesting Discussion)
      Requirements:

    1. Implement void debit(), void credit(), int getBalance(), List getLast5Txn()
    2. debit() and credit() should not be executed concurrently to mitigate dirty read-write.
    3. In any case getBalance() and getLast5Txn() should not be blocked. (Even if it’s dirty read, we should allow that)
      Solution:

    1. Simply putting synchronized before debit() and credit() won’t work. As per theinternal working when you put synchronized on any instance method, whole object will be locked.So in this case getBalance() and getLast5Txn() will be locked even when we didn’t put the synchronized keyword.
    2. Maintain balance variable in another class and at the time of debit() and credit(), acquire the lock on the new class (Using Synchronized block)
    3. Use Readers Writers Lock
      Counter Questions:

    1. when synchronized is used with static method, what happens? -> Lock is acquired on class level
    2. Given some examples, where he added synchronized on some instance/static methods and asked what happens in this case or in that case?
    3. Method level Synchronization vs Block Level Synchronization?
  • 4. Find first non-repeating character in very long string.link: Given a string, find its first non-repeating character
      After this, he modified the question, now m machines and n cores are given.

    1. Modify the above algorithm to leverage the power of the Multi-Cluster System.
    2. With some hints, I was able to design an algorithm (Based on Map-Reduce framework)
  • Then, HR came and asked some basic questions. After which, he informed me I am done for the day.

General Note:

  • I prepare almost all the DS/Algo Questions, production level code was expected.
  • They were focussing on Code Quality and Maintainability as well. (Modular Approach)
  • You should know 100% of your resume. As I already mentioned, My whole resume was covered after 8 rounds
  • In Round 4 to Round 8, there was a panel of 2 people.
  • After a month, I got an offer from GS.



Last Updated : 22 Nov, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads