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

SDE - Intern

Goldman Sachs
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Journey
I applied for an on-campus opportunity at Goldman Sachs during my internship season in 2024. I prepared for around 2–3 months before the season, during which I practiced a lot of DSA and competitive programming on coding platforms.
Application story
I applied for the role through the on-campus placement portal at IIT Guwahati. My journey began in August, with a strong focus on DSA and core computer science subjects. The process started with a rigorous Online Assessment (OA), which included sections on coding, math/aptitude, and CS fundamentals. After clearing the OA, I was shortlisted for the on-campus interview rounds.
Why selected/rejected for the role?
I was rejected for this role. After clearing the OA, I was confident I could do well in the interviews, but I fumbled because it was my first offline interview.
Preparation
Duration: 2 - 3 months
Topics: Data Structures, pointers, OOPs, algorithms, dynamic programming, trees, graphs
Tip
Tip

Tip 1: Practice coding questions if you are applying for an SDE position.

Tip 2: Also, practice basic OOP concepts.

Tip 3: Solve puzzles from Brainstellar.

Application process
Where: Campus
Eligibility: No criteria, (Salary Package - 18 LPA)
Resume Tip
Resume tip

Tip 1: Have some projects on your resume.

Tip 2: Do not include false information on your resume.

Interview rounds

01
Round
Medium
Online Coding Test
Duration90 minutes
Interview date17 Jul 2024
Coding problem2

It was conducted online during daytime.

1. XOR Property

Easy
15m average time
80% success
0/40
Asked in companies
OracleGoldman SachsPaisabazaar

You are given a Full Binary Tree with N nodes. Your task is to check whether it satisfies XOR Property.

XOR Property of Binary Tree: Every node should be XOR of it's left and right child.

For Example :
Consider the Binary Tree below :

Alt Text

Here only node 1 has both its children. Also 1 = 3^2. So the answer for the above test case is true. We consider the xor only when both the children are present.
Problem approach

Step 1: Compute Subtree Sums

Perform a Post-order Traversal (DFS) to calculate the sum of each subtree.

Let S(u) be the sum of the subtree rooted at u.

S(u)=arr[u]+∑S(v) for all children v of u.

Store these sums in an array.

Step 2: Define the "Non-Overlapping" Constraint

Two subtrees rooted at u and v are non-overlapping if:

v is not in the subtree of u.

u is not in the subtree of v.
To handle this efficiently, we use the property that for any edge (u, parent), if we "cut" it, we split the tree into two disjoint components: the subtree at u and the rest of the tree.

Step 3: Two-Pass DFS with a Trie

The core challenge is finding the max XOR between a subtree and any other subtree that is not its descendant/ancestor.

First Pass (Pre-order): As you traverse down, the "already processed" subtrees in other branches are valid candidates for XOR.

The Trie Strategy:

Maintain a Binary Trie to store subtree sums encountered so far.

For each node u, we want to find a value X in the Trie that maximizes S(u)⊕X.

Standard Trie Max-XOR logic: For each bit of S(u) from 31 down to 0, try to move to the branch representing the opposite bit.

Step 4: Global Maximum

Since the "other" subtree could be anywhere else, we actually need to track the maximum possible XOR found by either:

A subtree in the current path vs. a subtree in a previously visited sibling's branch.

A subtree vs. the remaining part of the tree (TotalSum−S(u)).

Try solving now

2. Minimum Operations

Easy
20m average time
82% success
0/40
Asked in companies
MicrosoftBNY MellonLinkedIn

You are given an array 'ARR' of 'N' positive integers. You need to find the minimum number of operations needed to make all elements of the array equal. You can perform addition, multiplication, subtraction or division with any element on an array element.

Addition, Subtraction, Multiplication or Division on any element of the array will be considered as a single operation.

Example:

If the given array is [1,2,3] then the answer would be 2. One of the ways to make all the elements of the given array equal is by adding 1 to the array element with value 1 and subtracting 1 from the array element with value 3. So that final array would become [2,2,2]. 
Problem approach

Step 1: Understand the Target State

When you perform A[j]=A[i]∣A[j] for all j, the new value of every element will at least contain all the bits that were set in A[i]. If you perform this multiple times using different indices i1​,i2​,..., eventually every element in the array will become the Bitwise OR of all elements in the original array (let's call this target).
Step 2: Check for 0 Operations

First, check if all elements in the array are already equal. If they are, the answer is 0.
Step 3: Check for 1 Operation

Is it possible to make all elements equal in one step? This happens if there exists an index i such that after picking it, every A[j]∣A[i] becomes the same value.

This is only possible if for some i, A[j]∣A[i] equals a constant for all j.

Specifically, that constant must be the target (the OR of the entire array).

Condition: If there exists an A[i] such that for all j, A[j]∣A[i]==target, then the answer is 1.

Step 4: Check for 2 Operations

If no single element can "pull" all others to the target value, can two elements do it?

In bitwise OR operations, picking two indices i and k sequentially is equivalent to picking one element that is (A[i]∣A[k]).

Since the maximum value is small (5000, which is <213), we can use a Bitmask BFS or a greedy check.

However, a key observation: For most cases where 0 or 1 doesn't work, 2 operations will suffice. You pick one element to cover some bits, and another to cover the remaining bits.

Try solving now
02
Round
Easy
Video Call
Duration60 minutes
Interview date27 Jul 2024
Coding problem2

1. Find Peak Element

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

You are given an array 'arr' of length 'n'. Find the index(0-based) of a peak element in the array. If there are multiple peak numbers, return the index of any peak number.


Peak element is defined as that element that is greater than both of its neighbors. If 'arr[i]' is the peak element, 'arr[i - 1]' < 'arr[i]' and 'arr[i + 1]' < 'arr[i]'.


Assume 'arr[-1]' and 'arr[n]' as negative infinity.


Note:
1.  There are no 2 adjacent elements having same value (as mentioned in the constraints).
2.  Do not print anything, just return the index of the peak element (0 - indexed).
3. 'True'/'False' will be printed depending on whether your answer is correct or not.


Example:

Input: 'arr' = [1, 8, 1, 5, 3]

Output: 3

Explanation: There are two possible answers. Both 8 and 5 are peak elements, so the correct answers are their positions, 1 and 3.


Problem approach

Step 1: Initialize Search Range

Set two pointers, low = 0 and high = n - 1. Calculate the middle index mid = low + (high - low) / 2. The goal is to use the "slope" at mid to decide which direction to move.
Step 2: Compare Mid with its Right Neighbor

Compare arr[mid] with arr[mid + 1]:

If arr[mid] < arr[mid + 1]: You are on an upward slope. This means there must be a peak to the right of mid. Therefore, move the search range to the right by setting low = mid + 1.

If arr[mid] > arr[mid + 1]: You are either on a downward slope or at a peak. This means a peak exists at mid or to its left. Move the search range to the left by setting high = mid.

Step 3: Converge on the Peak

Repeat the process until low == high. At this point, the pointers will have converged on a peak element. Return low (or high). Because we always move toward the "higher" side, we are guaranteed to find a local maximum.

Try solving now

2. Trie Implementation

Moderate
25m average time
65% success
0/80
Asked in companies
MicrosoftGoldman SachsMedia.net

Implement a Trie Data Structure which supports the following three operations:

Operation 1 - insert(word) - To insert a string WORD in the Trie.

Operation 2-  search(word) - To check if a string WORD is present in Trie or not.

Operation 3-  startsWith(word) - To check if there is a string that has the prefix WORD.


Trie is a data structure that is like a tree data structure in its organisation. It consists of nodes that store letters or alphabets of words, which can be added, retrieved, and deleted from the trie in a very efficient way.


In other words, Trie is an information retrieval data structure, which can beat naive data structures like Hashmap, Tree, etc in the time complexities of its operations.


The above figure is the representation of a Trie. New words that are added are inserted as the children of the root node. 

Alphabets are added in the top to bottom fashion in parent to children hierarchy. Alphabets that are highlighted with blue circles are the end nodes that mark the ending of a word in the Trie.


For Example:-
Type = ["insert", "search"], Query = ["coding", "coding].
We return ["null", "true"] as coding is present in the trie after 1st operation.
Problem approach

Step 1: Define the TrieNode Structure

Each node represents a single character. It needs:

An array (or hash map) of pointers to its children (size 26 for lowercase English letters).

A boolean flag isEndOfWord to mark the completion of a valid word.

Step 2: Implement the Core Logic

Insert: Iterate through the word character by character. If a child for the current character doesn't exist, create a new node. Move to that child. Mark the last node's isEndOfWord as true.

Search/StartsWith: Navigate the tree following the characters of the input string. If at any point a pointer is NULL, the word/prefix doesn't exist. For Search, also check if the final node has isEndOfWord == true.

Try solving now

Here's your problem of the day

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

Skill covered: Programming

What does the SQL function NOW() return?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 5 problems
Interviewed by Goldman Sachs
2553 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 11 problems
Interviewed by Goldman Sachs
6024 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Goldman Sachs
1039 views
1 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Goldman Sachs
845 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Amazon
15731 views
4 comments
0 upvotes
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
15671 views
1 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Amazon
10289 views
2 comments
0 upvotes