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

SDE - 1

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

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, java , OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1 - Practice Atleast 250 Questions from coding ninjas
Tip 2 - Ex- Do atleast 2 good projects

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

Tip 1 : Have some good projects on resume.
Tip 2 : Do not put false things on resume and be confident.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration90 minutes
Interview date22 Jul 2021
Coding problem1

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)
Question 2: Find Recurring Sequence in a Fraction

1. Count Ways To Reach The N-th Stairs

Moderate
30m average time
80% success
0/80
Asked in companies
OYOLinkedInGrab

You have been given a number of stairs. Initially, you are at the 0th stair, and you need to reach the Nth stair.


Each time, you can climb either one step or two steps.


You are supposed to return the number of distinct ways you can climb from the 0th step to the Nth step.

Note:

Note: Since the number of ways can be very large, return the answer modulo 1000000007.
Example :
N=3

Example

We can climb one step at a time i.e. {(0, 1) ,(1, 2),(2,3)} or we can climb the first two-step and then one step i.e. {(0,2),(1, 3)} or we can climb first one step and then two step i.e. {(0,1), (1,3)}.
Problem approach

The person can reach nth stair from either (n-1)th stair or from (n-2)th stair. Hence, for each stair n, we try to find out the number of ways to reach n-1th stair and n-2th stair and add them to give the answer for the nth stair. Therefore the expression for such an approach comes out to be : 

ways(n) = ways(n-1) + ways(n-2)

Try solving now
02
Round
Medium
Face to Face
Duration60 minutes
Interview date23 Jul 2021
Coding problem2

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.

1. Implement Deque

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

Design a data structure to implement deque of size ‘N’. It should support the following operations:

pushFront(X): Inserts an element X in the front of the deque. Returns true if the element is inserted, otherwise false.

pushRear(X): Inserts an element X in the back of the deque. Returns true if the element is inserted, otherwise false.

popFront(): Pops an element from the front of the deque. Returns -1 if the deque is empty, otherwise returns the popped element.

popRear(): Pops an element from the back of the deque. Returns -1 if the deque is empty, otherwise returns the popped element.

getFront(): Returns the first element of the deque. If the deque is empty, it returns -1.

getRear(): Returns the last element of the deque. If the deque is empty, it returns -1.

isEmpty(): Returns true if the deque is empty, otherwise false.

isFull(): Returns true if the deque is full, otherwise false.

Following types of queries denote these operations:

Type 1: for pushFront(X) operation.
Type 2: for pushRear(X) operation.
Type 3: for popFront() operation.
Type 4: for popRear() operation.
Type 5: for getFront() operation.
Type 6: for getRear() operation.
Type 7: for isEmpty() operation.
Type 8: for isFull() operation.
Problem approach

Since Deque is an interface, objects cannot be created of the type deque. We always need a class that extends this list in order to create an object. And also, after the introduction of Generics in Java 1.5, it is possible to restrict the type of object that can be stored in the Deque.

Try solving now

2. Gold mine problem

Moderate
35m average time
70% success
0/80
Asked in companies
Goldman SachsAmazonBNY Mellon

You have been given a gold mine represented by a 2-d matrix of size ('N' * 'M') 'N' rows and 'M' columns. Each field/cell in this mine contains a positive integer, the amount of gold in kgs.

Initially, the miner is at the first column but can be at any row.

He can move only right, right up, or right down. That is from a given cell and the miner can move to the cell diagonally up towards the right or right or diagonally down towards the right.

Find out the maximum amount of gold he can collect.

Problem approach

we will travel two paths from (0, 0) to (N-1, M-1) simultaneously, so at each step, we take one step for both paths. So our state will consist of (x1, y1, x2, y2) where (x1, y1) is the position of the first path and (x2, y2) is the position of the second tourist in the grid.

Try solving now
03
Round
Hard
Video Call
Duration60 minutes
Interview date23 Jul 2021
Coding problem1

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.

1. Boundary Traversal of binary tree

Hard
20m average time
85% success
0/120
Asked in companies
Goldman SachsOYOExpedia Group

You are given a binary tree having 'n' nodes.


The boundary nodes of a binary tree include the nodes from the left and right boundaries and the leaf nodes, each node considered once.


Figure out the boundary nodes of this binary tree in an Anti-Clockwise direction starting from the root node.


Example :
Input: Consider the binary tree A as shown in the figure:

alt text

Output: [10, 5, 3, 7, 18, 25, 20]

Explanation: As shown in the figure

The nodes on the left boundary are [10, 5, 3]

The nodes on the right boundary are [10, 20, 25]

The leaf nodes are [3, 7, 18, 25].

Please note that nodes 3 and 25 appear in two places but are considered once.
Problem approach

1. Print the left boundary in top-down manner. 
2. Print all leaf nodes from left to right
3. Print the right boundary in bottom-up manner.

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

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

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Goldman Sachs
1883 views
0 comments
0 upvotes
company logo
SDE - 1
1 rounds | 3 problems
Interviewed by Goldman Sachs
1375 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by Goldman Sachs
2094 views
0 comments
0 upvotes
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Goldman Sachs
974 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
115097 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
58238 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
35147 views
7 comments
0 upvotes