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

Analyst

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

Interview preparation journey

expand-icon
Preparation
Duration: 5 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS, Puzzles
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

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

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Medium
Face to Face
Duration60 minutes
Interview date15 Dec 2016
Coding problem2

Technical Interview round with questions on DSA.

1. Search In A Row Wise And Column Wise Sorted Matrix

Moderate
15m average time
80% success
0/80
Asked in companies
NoBrokerOracleGoldman Sachs

You are given an 'N * N' matrix of integers where each row and each column is sorted in increasing order. You are given a target integer 'X'.


Find the position of 'X' in the matrix. If it exists then return the pair {i, j} where 'i' represents the row and 'j' represents the column of the array, otherwise return {-1,-1}


For example:
If the given matrix is:
[ [1, 2, 5],
  [3, 4, 9],
  [6, 7, 10]] 
We have to find the position of 4. We will return {1,1} since A[1][1] = 4.
Problem approach

The brute force solution is to traverse the array and to search elements one by one. Run a nested loop, outer loop for row and inner loop for the column
Check every element with x and if the element is found then print “element found”. If the element is not found, then print “element not found”.
Efficient Approach : The idea here is to remove a row or column in each comparison until an element is found. Start searching from the top-right corner of the matrix. There are three possible cases : 
1. The given number > the current number: This will ensure that all the elements in the current row are smaller than the given number as the pointer is already at the right-most elements and the row is sorted. Thus, the entire row gets eliminated and continues the search for the next row. 
2. The given number < the current number: This will ensure that all the elements in the current column are greater than the given number. Thus, the entire column gets eliminated and continues the search for the previous column, i.e. the column on the immediate left.
3. The given number == the current number: This will end the search.
• Algorithm: 
1. Let the given element be x, create two variable i = 0, j = n-1 as index of row and column
2. Run a loop until i = n
3. Check if the current element is greater than x then decrease the count of j. Exclude the current column.
4. Check if the current element is less than x then increase the count of i. Exclude the current row.
5. If the element is equal, then print the position and end.

Try solving now

2. Longest Common Substring

Moderate
25m average time
75% success
0/80
Asked in companies
Wells FargoAdobeGoldman Sachs

You are given two strings, 'str1' and 'str2'. You have to find the length of the longest common substring.


A substring is a continuous segment of a string. For example, "bcd" is a substring of "abcd", while "acd" or "cda" are not.


Example:
Input: ‘str1’ = “abcjklp” , ‘str2’ = “acjkp”.

Output: 3

Explanation:  The longest common substring between ‘str1’ and ‘str2’ is “cjk”, of length 3.
Problem approach

Naive Approach: The idea is to generate all the subarrays of the two given arrays and find the longest matching subarray. 
Time Complexity: O(2^(N+M)), where N and M are the length of the arrays.

Efficient Approach: 
The efficient approach is to use Dynamic Programming(DP). This problem is a modification of the Longest Common Subsequence(LCS) problem.
Let the input sequences are A[0..n-1] and B[0..m-1] of lengths m & n respectively. 
Following is the recursive implementation of the equal subarrays: 
Since common subarray of A[] and B[] must start at some index i and j such that A[i] is equals to B[j]. Let dp[i][j] be the longest common subarray of A[i…] and B[j…].
Therefore, for any index i and j, if A[i] is equals to B[j], then dp[i][j] = dp[i+1][j+1] + 1.
The maximum of all the element in the array dp[][] will give the maximum length of equal subarrays.
Time Complexity: O(N*M)
Auxiliary Space: O(N*M)

Try solving now
02
Round
Medium
Face to Face
Duration60 minutes
Interview date15 Dec 2016
Coding problem3

Technical Interview round with questions on puzzles.

1. Puzzle

What is the expected number of coin flips until you get 3 heads in a row?

Problem approach

Let X3 be the number of tosses required to observe three consecutive heads. 
Notice that either a tail comes first (with probability 50%) or two consecutive heads come first ( with probability 25%) or a head comes first followed by a tail on the first two tosses (with probability 25%). These three possibilities form a partition (as they are disjoint and their union is the whole sample space). Also, notice that it is fairly easy to find the conditional expectation of X3 given any of these events in terms of the unconditional expectation of X3 .

If T , then E(X3|T)=1+E(X3). 

If HH , then E(X3|HH)=0.5⋅3+0.5⋅(3+E(X3)) .

If HT , then E(X3|HT)=2+E(X3) .

Combining these three by multiplying each by its probability and adding gives the expected value we seek:

E(X3)=0.5⋅(1+E(X3))+0.25⋅(0.5⋅3+0.5⋅(3+E(X3)))+0.25⋅(2+E(X3)) 

This reduces to:
18E(X3)=74 ⟹ E(X3)=14

2. Puzzle

There is a box with 2 white balls and 8 black balls. The balls are drawn and then put back in the box. The player who draws a white ball first wins the game. Player A starts.

What is the probability the player A wins?

Problem approach

Let E denote the event that the first ball drawn is a white one. Then:

P(A wins)=P(A wins|E)P(E)+P(A wins|Ec)P(Ec)
Now realize that:
P(A wins|Ec)=1−P(A wins)
This because under condition Ec the game somehow starts over, but now with player B as the one who draws the first ball.

Defining p:=P(A wins) we come to the following equation in p:
p=1×1/5+(1−p)×4/5=1−4/5 * p
and find that:
p=5/9=0.5555…

3. Puzzle

If you roll a die n times, what is the expected value for the sum of the faces?

Problem approach

There are two things you need to know about in order to compute this expected value. First, the definition of expected value is E(X)=∑x⋅p(x) . For a die roll, this is 1⋅1/6+2⋅1/6+3⋅1/6+4⋅1/6+5⋅1/6+6⋅1/6=21/6 .

Second, expected value is linear, meaning that the expected value of the sum of random variables is the sum of their expected values. This means that if you roll n dice, the expected value of the sum of the faces is n times the expected value of a single face, or 21/6n .

03
Round
Easy
HR Round
Duration30 minutes
Interview date15 Dec 2016
Coding problem1

Typical Managerial round.

1.

Why do you want to join Goldman Sachs?
Walk me through your resume.

Problem approach

Tip 1 : The cross questioning can go intense some time, think before you speak.

Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.

Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round, like what are the projects currently the company is investing, which team you are mentoring. How all is the work environment etc.

Here's your problem of the day

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

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
Analyst
3 rounds | 8 problems
Interviewed by Goldman Sachs
1218 views
0 comments
0 upvotes
company logo
Analyst
5 rounds | 7 problems
Interviewed by Goldman Sachs
2205 views
1 comments
0 upvotes
company logo
Analyst
6 rounds | 12 problems
Interviewed by Goldman Sachs
0 views
0 comments
0 upvotes
company logo
Analyst
3 rounds | 5 problems
Interviewed by Goldman Sachs
8167 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Analyst
3 rounds | 4 problems
Interviewed by Ernst & Young (EY)
2197 views
1 comments
0 upvotes
company logo
Analyst
2 rounds | 7 problems
Interviewed by Dunzo
876 views
0 comments
0 upvotes
company logo
Analyst
3 rounds | 9 problems
Interviewed by HCL Technologies
0 views
0 comments
0 upvotes