Goldman Sachs interview experience Real time questions & tips from candidates to crack your interview

SDE - Intern

Goldman Sachs
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 12 months
Topics: Data Structure, C++, OOPs, Networking, Aptitude, Dynamic Programming
Tip
Tip

Tip 1 : Do not panic and Remain calm. Be Honest(in both Resume and during the Interview).
Tip 2 : Listen to the PPTs of the companies properly.
Tip 3 : While you are solving a question, speak to the interviewer.
Tip 4 : Data Structures, Problem Solving is very important. Good CGPA helps, personal projects, extracurricular activities would also give you an edge.

Application process
Where: Campus
Eligibility: 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have some good projects on your resume and study those.
Tip 2 : Don't lie on your resume, as they are very much experienced.

Interview rounds

01
Round
Hard
Online Coding Interview
Duration135 minutes
Interview date15 Oct 2020
Coding problem3

(Online Assessment Test): Platform was HackerRank with tab proctoring and webcam proctoring enabled. This round consisted of 5 sections(There was a section-wise time limit)

Section 1:
=> 2 coding questions of moderate level (Time: 30 Minutes)
=> 5 languages allowed: CPP, java, java8, python, python3

Section 2: (Maths and Quant):
=> Marking: +5,-2
=> Time: 25 min
=> 8 MCQs
=> Questions on probability, combinatorics, binomial theorem, etc.

Section 3: (CS MCQs):
=> Marking:+5,-2
=> Time: 20 min
=> 7 MCQs
=> Based on topics like Data structures, Algorithms, OS, Networking, etc.

Section 4:
=> The Advanced Programming Section had 1 programming question.
=>Time: 45 mins.

Section 5:
=> 2 value-based type questions each having 10 marks(to be answered in brief)
=> Time: 15 min
The questions of section 5 were as follows:
1. Suppose you and your friend are doing an important project having some deadline. Then suddenly your friend left the project in the middle because of some unavoidable reasons. What will you do in that situation?
2. Mention one instance where you were highly motivated and excited for a project and you achieved exceptional results in it.

Shortlist Criteria, GS follow GPA+TEST Score. 54 students were shortlisted for the next Rounds.

1. Largest rectangle in a histogram

Hard
25m average time
75% success
0/120
Asked in companies
DelhiveryCultfitGoldman Sachs

You have been given an array/list 'HEIGHTS' of length ‘N. 'HEIGHTS' represents the histogram and each element of 'HEIGHTS' represents the height of the histogram bar. Consider that the width of each histogram is 1.

You are supposed to return the area of the largest rectangle possible in the given histogram.

For example :
In the below histogram where array/list elements are {2, 1, 5, 6, 2, 3}.

alt text

The area of largest rectangle possible in the given histogram is 10.
Problem approach

This problem can be solved as follow:
For every bar ‘x’, we calculate the area with ‘x’ as the smallest bar in the rectangle. If we calculate such an area for every bar ‘x’ and find the maximum of all areas, our task is done. How to calculate the area with ‘x’ as the smallest bar? We need to know the index of the first smaller (smaller than ‘x’) bar on the left of ‘x’ and the index of the first smaller bar on the right of ‘x’. Let us call these indexes ‘left index’ and ‘right index’ respectively.
We traverse all bars from left to right, maintain a stack of bars. Every bar is pushed to stack once. A bar is popped from the stack when a bar of smaller height is seen. When a bar is popped, we calculate the area with the popped bar as the smallest bar. How do we get left and right indexes of the popped bar – the current index tells us the ‘right index’ and the index of the previous item in the stack is the ‘left index’. Following is the complete algorithm.

1) Create an empty stack.

2) Start from the first bar, and do the following for every bar ‘hist[i]’ where ‘i’ varies from 0 to n-1.
……a) If the stack is empty or hist[i] is higher than the bar at top of the stack, then push ‘i’ to stack.
……b) If this bar is smaller than the top of the stack, then keep removing the top of the stack while the top of the stack is greater. Let the removed bar be hist[tp]. Calculate the area of the rectangle with hist[tp] as the smallest bar. For hist[tp], the ‘left index’ is the previous (previous to tp) item in the stack, and the ‘right index’ is ‘i’ (current index).

3) If the stack is not empty, then one by one remove all bars from the stack and do step 2.b for every removed bar.

Try solving now

2. Merge overlapping intervals

Easy
10m average time
90% success
0/40
Asked in companies
MongoDBJP MorganMorgan Stanley

Given 'N' number of intervals, where each interval contains two integers denoting the boundaries of the interval. The task is to merge all the overlapping intervals and return the list of merged intervals sorted in ascending order.

Two intervals will be considered to be overlapping if the starting integer of one interval is less than or equal to the finishing integer of another interval, and greater than or equal to the starting integer of that interval.

Example:
for the given 5 intervals - [1,4], [3,5], [6,8], [10,12], [8,9].
Since intervals [1,4] and [3,5] overlap with each other, we will merge them into a single interval as [1,5].

Similarly [6,8] and [8,9] overlaps, we merge them into [6,9].

Interval [10,12] does not overlap with any interval.

Final List after merging overlapping intervals: [1,5], [6,9], [10,12]
Problem approach

I solved this problem using the concept of connected components.

If we draw a graph (with intervals as nodes) that contains undirected edges between all pairs of intervals that overlap, then all intervals in each connected component of the graph can be merged into a single interval.

Algorithm
With the above intuition in mind, we can represent the graph as an adjacency list, inserting directed edges in both directions to simulate undirected edges. Then, to determine which connected component each node is in, we perform graph traversals from arbitrary unvisited nodes until all nodes have been visited. To do this efficiently, we store visited nodes in a Set, allowing for constant time containment checks and insertion. Finally, we consider each connected component, merging all of its intervals by constructing a new Interval with start equal to the minimum start among them and end equal to the maximum end.

This algorithm is correct simply because it is basically the brute force solution. We compare every interval to every other interval, so we know exactly which intervals overlap. The reason for the connected component search is that two intervals may not directly overlap, but might overlap indirectly via a third interval.

Try solving now

3. Longest Palindromic Substring

Moderate
20m average time
80% success
0/80
Asked in companies
MicrosoftCIS - Cyber InfrastructureGartner

You are given a string 'str' of length 'N'.


Your task is to return the longest palindromic substring. If there are multiple strings, return any.


A substring is a contiguous segment of a string.


For example :
str = "ababc"

The longest palindromic substring of "ababc" is "aba", since "aba" is a palindrome and it is the longest substring of length 3 which is a palindrome. 

There is another palindromic substring of length 3 is "bab". Since starting index of "aba" is less than "bab", so "aba" is the answer.
Problem approach

We observe that a palindrome mirrors around its center. Therefore, a palindrome can be expanded from its center, and there are only 2n−1 such centers.

You might be asking why there are 2n−1 but not n centers? The reason is the center of a palindrome can be in between two letters. Such palindromes have an even number of letters (such as "abba") and their center is between the two 'b's.

time complexity: O(n^2)

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date16 Oct 2020
Coding problem1

The platform was Zoom for video calls and HackerRank CodePair for coding.

This round began with a formal introduction, followed by a few questions related to the work I have done as Technical Head in the Placement Cell during Under Graduation. Then, he asked me how much I rate myself in problem-solving and coding skills and justify why I think so.

Then, he asked to write code for the problem:

Sort the array of strings according to the new alphabetical order. New alphabetical order starts with a given character ‘c’.

After that, he asked me If I had any questions to ask.

This round went very well, and I was selected for the next round.

1. Sort Array of Strings

Easy
15m average time
85% success
0/40
Asked in companies
FlipkartIBMGoldman Sachs

You are given an array of strings 'ARRSTR[]' of size 'N' and a character 'C'. Your task is to sort the 'ARRSTR[]' according to the new alphabetical order that starts with the given character 'C'.

Note:

1) The character ‘C’ is a lowercase English alphabet that is given as input.
2) For example, if the character is 'C' is "d" then, the alphabetical order starts with "d" will look like {d,e,f,....,y,z,a,b,c}.
3) Every string in the array consists of only lowercase English alphabets.
Problem approach

I wrote the code for the same using Bubble Sort and wrote a compare function according to the new alphabetical order. The interviewer then asked me to explain the time complexity of the sorting algorithm and also a few other questions related to other sorting algorithms like which are better in which scenarios etc…

I used the hashing concept in the compare function and an array for the same, he then asked me to write code without using any extra space and asked me to explain time and space complexity.

Try solving now
03
Round
Medium
HR Round
Duration60 minutes
Interview date16 Oct 2020
Coding problem1

The Interviewer had my CV this time. He started by asking me about the experience of the previous Interview round.

He then asked me to introduce myself and asked me to tell more about my strengths, language preferences, and technical skills.

Then for the next 20-25 minutes, he asked questions related to the project I mentioned. He particularly asked me to explain in detail the part of the project that my other teammate did. He also asked questions like what I learned from this, what was the motive behind this etc…

Since I mentioned in my introduction that I had an interest in the Data Science Field, he asked a few questions related to data mining, data pre-processing, machine learning algorithms, libraries used for the same, etc.

 

1. General Questions

How could you be an asset to the company?
How do you think this Internship could help you?
What makes you think you are a good team player and have good coordination skills?

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

Which operator is used for exponentiation in Python?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 11 problems
Interviewed by Goldman Sachs
5548 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Goldman Sachs
771 views
1 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Goldman Sachs
587 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 14 problems
Interviewed by Goldman Sachs
548 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
13855 views
4 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
13095 views
1 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
9196 views
2 comments
0 upvotes