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

SDE - 1

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

Interview preparation journey

expand-icon
Journey
This was a college placement drive arranged.I attended it and gave my best. I only got into the first round. I must have practiced more. This was a good opportunity to understand where i stood.
Application story
This was a placement drive to which I applied. This drive was for my 7th sem intern. we were prepared by college by it.
Why selected/rejected for the role?
I was not selected for this role , maybe should have tried harder. I only went till 1st round didn't go further.
Preparation
Duration: 3 months
Topics: Data structures , Algorithm , OOPS , pointers , Algorithms
Tip
Tip

Tip 1 : practice competitive programming regularly
Tip 2 : look at interview experience
Tip 3 : talk to seniors who work there

Application process
Where: Campus
Eligibility: no
Resume Tip
Resume tip

Tip 1: get it reviewed by professional
Tip 2: mention only what you know

Interview rounds

01
Round
Easy
Online Coding Interview
Duration60 mins
Interview date2 Feb 2021
Coding problem2

1. Copy List with Random Pointer

Easy
10m average time
90% success
0/40
Asked in companies
MicrosoftUrban Company (UrbanClap)Amazon

Given a linked list having two pointers in each node. The first one points to the next node of the list, however, the other pointer is random and can point to any node of the list or null. The task is to create a deep copy of the given linked list and return its head. We will validate whether the linked list is a copy of the original linked list or not.

A deep copy of a Linked List means we do not copy the references of the nodes of the original Linked List rather for each node in the original Linked List, a new node is created.

For example,

example

Random pointers are shown in red and next pointers in black.

Problem approach

Follow the given steps to solve the problem:

Recursively call to merge the current linked list with the next linked list
If the current linked list is empty or there is no next linked list then return the current linked list (Base Case)
Start merging the linked lists, starting from the last linked list
After merging the current linked list with the next linked list, return the head node of the current linked list

Try solving now

2. Queue Using Stack

Moderate
30m average time
60% success
0/80
Asked in companies
AdobeLivekeeping (An IndiaMART Company)GE (General Electric)

Implement a queue data structure which follows FIFO(First In First Out) property, using only the instances of the stack data structure.


Note:
1. To implement means you need to complete some predefined functions, which are supported by a normal queue such that it can efficiently handle the given input queries which are defined below.


2. The implemented queue must support the following operations of a normal queue: 

a. enQueue(data) : This function should take one argument of type integer and place the integer to the back of the queue.

b. deQueue(): This function should remove an integer from the front of the queue and also return that integer. If the queue is empty, it should return -1.

c. peek(): This function returns the element present in the front of the queue. If the queue is empty, it should return -1.

d. isEmpty(): This function should return true if the queue is empty and false otherwise.


3. You will be given q queries of 4 types:

a. 1 val - For this type of query, you need to insert the integer val to the back of the queue.

b. 2 - For this type of query, you need to remove the element from the front of the queue, and also return it.

c. 3 - For this type of query, you need to return the element present at the front of the queue(No need to remove it from the queue).

d. 4 - For this type of query, you need to return true if the queue is empty and false otherwise.


4. For every query of type:

a. 1, you do not need to return anything.

b. 2, return the integer being deQueued from the queue.

c. 3, return the integer present in the front of the queue.

d. 4, return “true” if the queue is empty, “false” otherwise.
Example
Operations: 
1 5
1 10
2
3
4

Enqueue operation 1 5: We insert 5 at the back of the queue.
Queue: [5]

Enqueue operation 1 10: We insert 10 at the back of the queue.
Queue: [5, 10]

Dequeue operation 2: We remove the element from the front of the queue, which is 5, and print it.
Output: 5
Queue: [10]

Peek operation 3: We return the element present at the front of the queue, which is 10, without removing it.
Output: 10
Queue: [10]

IsEmpty operation 4: We check if the queue is empty.
Output: False
Queue: [10]
Problem approach

This method makes sure that oldest entered element is always at the top of stack 1, so that deQueue operation just pops from stack1. To put the element at top of stack1, stack2 is used.

Try solving now
02
Round
Medium
Online Coding Interview
Duration15 mins
Interview date3 Feb 2021
Coding problem1

1. Best Time to Buy and Sell Stock II

Moderate
22m average time
0/80
Asked in companies
Goldman SachsPhonePeLinkedIn

You have been given stock values/prices for N number of days. Every i-th day signifies the price of a stock on that day. Your task is to find the maximum profit which you can make by buying and selling the stocks.

 Note :
You may make as many transactions as you want but can not have more than one transaction at a time i.e, if you have the stock, you need to sell it first, and then only you can buy it again.
Problem approach

Based on the fact that we have to sell after we buy and we are trying to maximize profit, we can iterate through the prices and only need to consider two things:
1.) Is this price cheaper than any other price I've seen before?
2.) If I subtract current price by the cheapest price I've found, does this yield a greater profit than what I've seen so far?

A fun thing to note is if #1 is true, then #2 cannot be true as well so there isn't a need to check

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