# Goldman Sachs interview experience

********** Goldman Sachs Technical Interview (For Experienced Hire) **********

(Dec 2018 – Jan 2019)

——————————————————————————

———————————————————

**** HackerRank Test – 90 mins – 2 questions ****

———————————————————

1) Count no. of sub-arrays that add to a given sum

Examples:-

Input : arr[] = {10, 2, -2, -20, 10},

k = -10

Output : 3

Subarrays: arr[0…3], arr[1…4], arr[3..4] have sum exactly equal to -10.

Input : arr[] = {9, 4, 20, 3, 10, 5},

k = 33

Output : 2

Subarrays : arr[0…2], arr[2…4] have sum exactly equal to 33.

2) A traveler visits multiple cities. He can work daily and make some money. He also spends some money on each day. An array is given depicting his daily savings (earnings – expenses) over the course of his journey. How much minimum money he should start with in order to have atleast some saving ( > 0) at the end of each day.

Examples:-

Input : arr[] = { 10, -5, 7, -8, 5, -9 }

Let’s say he starts with x.

At end of:-

Day 1, he has a saving of(x + 10)

Day 2, he has a saving of(x + 5)

Day 3, he has a saving of(x + 12)

Day 4, he has a saving of(x + 4)

Day 5, he has a saving of(x + 9)

Day 6, he has a saving of(x + 0)

So, minimum value of x to satisfy the given condition is 1 (one).

———————————————————

**** Coderpad Round 1 ****

———————————————————

1)

Write a function that takes input and output as shown under:-

Input (string) Output (string)

—– ——

aaa a3

aabbcc a2b2c2

aaabcdd a3b1c1d2

a a1

2)

a) You are an avid rock collector who lives in southern California. Some rare and desirable rocks just became available in New York, so you are planning a cross-country road trip. There are several other rare rocks that you could pick up along the way. You have been given a grid filled with numbers, representing the number of rare rocks available in various cities across the country. Your objective is to find the optimal path from So_Cal to New_York that would allow you to accumulate the most rocks along the way.

Note: You can only travel either north (up) or east (right).

b) Consider adding some additional tests in doTestsPass().

c) Implement optimalPath() correctly.

d) Here is an example:

^

{{0, 0, 0, 0, 5}, New_York (finish) N

{0, 1, 1, 1, 0},

So_Cal (start) {2, 0, 0, 0, 0}} S

v

The total for this example would be 10 (2+0+1+1+1+0+5).

———————————————————

**** Coderpad Round 2 ****

———————————————————

1)

Given a string. Write a function to find the first non-repeating character in it. If there is no non-repeating character, return 0;

e.g.

Input (string) Output (char)

—– ——

aabbccd d

abbccddee a

iijjkkllmm 0

2)

Implement a function that takes two unsigned integers as arguments namely numerator & denominator and outputs a string representing the fraction in decimal form. If there is a repeating and non-terminating digit that appears in the decimal form, write that in parenthesis.

e.g.

Input (UINT n, UINT d) Output (string)

—– ——

2, 5 0.4

1, 2 0.5

1, 3 0.(3)

12, 5 2.4

11, 20 0.55

5, 3 1.(6)

———————————————————

**** In person Rounds on Super day ****

———————————————————

——————–

Round 1

——————–

1. Given a number, find the floor value of its cube root in the most optimal way. Number can be fairly large.

2. Given an array of integers from 1 to N where 1 number is missing. Find that number. In the same array, in addition to a missing number, there is a repeated number as well. Find that.

3. Sort an array of 0s and 1s. Don’t go for normal N log N sorting. Use the fact that the array has only 0s and 1s.

Same question for array containing 0s, 1s and 2s.

——————–

Round 2

——————–

Quickly tell about your work experience.

Why do you want to change from your current company?

1. Given a matrix (M × N) of 0s and 1s with all rows sorted. Find the first one column wise in most efficient manner.

2. Given an infinite number line (from -INF to +INF)

A person starts from zero and initially has a step size of 1. After each step, the step size increases by 1. E.g. from 0, he can go to 1 or -1 with step size of 1. From 1 he can go to to -1 or 3 as the step size has become 2 now and so on.

Find minimum no. of steps to reach a given number N.

3. A stream of binary data. Implement a data structure to hold a maximum of 100 of these data that were added recently. If data structure is full, remove the older data. At any time, user should be able to get the number of 1s.

4. Implement LRU cache.

——————–

Round 3

——————–

Quickly tell about your work experience.

Why do you want to change from your current company?

1. Explain Singleton Pattern. How will you avoid concurrency issues?

2. There are two processes running on two different hosts. Describe a mechanism by which they can interact and share data with each other without having a hard dependency on each other.

3. Consider a station with only 1 platform. Describe a mechanism to allocate platform to incoming trains. There can be unforeseen delays to the departure of a train from the platform due to multiple reasons.

4. Implement and Explain Blocking queue ( pseudo code )

——————–

Round 4

——————–

Several questions about current project and way of working. How do you measure quality? What practices do you follow during software development lifecycle? A lot of why this way and not that way type questions related to the current project.

——————–

Round 5

——————–

Quickly walk us through your resume and tell us something about your current project.

Why do you want to change from your current company (or change your domain of working?)

1. There is a language that contains let’s say a, b, c, d….n from English alphabet but order can be different.

Given a dictionary of this language which has words in sorted order. How will you figure out the order of alphabets in this language.

2. Implement a stack data structure which provides a function GetMin() that always returns the minimum element existing in the stack in O(1). ( Write code on paper )

3. Given an array of prices for a stock at different time intervals. Buy and sell stocks to maximize profit.

a) can buy and sell once

b) can buy and sell multiple times

——————–

Round 6

——————–

1. Implement a data structure that can store an incoming stream of integers and can return the minimum element so far at any time in O(1).

2. Given number of total steps to be taken and a list of possible smaller steps. Number of ways to take the given total steps using smaller steps. (This is similar to coin change problem that can be solved by Dynamic Programming)

e.g. N = 4 and smaller steps = {1, 2, 3}

then number of ways to take 4 steps using {1, 2, 3} is 7

[ (1, 1, 1, 1), (1, 1, 2), (1, 2, 1), (2, 1, 1), (1, 3), (3, 1), (2, 2) ]

——————–

Round 7

——————–

Discussion with Team Manager. Q&A about the job role or Goldman Sachs in general.

What do you know about Goldman Sachs?

Why do you want to join Goldman Sachs?

——————–

——————–

Bluejeans round (video conferencing) – 1

(With teams in London and New York)

——————–

How to detect a cycle in a linked list?

Questions about handling concurrency issues, usage of mutex and related questions.

Questions about your current job.

——————–

Bluejeans round (video conferencing) – 2

(With another team in New York)

——————–

Given an array of integers, and a number ‘sum’, find the number of pairs of integers in the array whose sum is equal to ‘sum’.

Some behavioural questions like “What is an ideal job/company for you?”

——————–

Final Discussion with hiring manager. This was more like a discussion than an interview.

Some technical questions were asked about experience with functional programming.

The overall process took above 2 months. During the rounds, the HR never had a word with me about the compensation. After going through all of the above process, they said a “YES” to me and the HR asked for my current salary details/ pay slips to make a final offer. But eventually they came with a number that was barely meeting my current compensation forget about a hike that one would expect from a new job. On my asking, the HR told me that the salaries for a strats profile are different. This is contrary to the team manager who had mentioned during round 7 that the salaries for both strats and tech team are similar when I had asked him differences between the day-to-day responsibilities in a strats role vs a tech role. Eventually, I decided to let go off their offer due to compensation. This was disappointing as GS has an image in the market for being good with compensation. What’s more worse is that they never asked any salary details at the beginning of the process and only after this mammoth process of interviewing.

**Join Free Interview Preparation Course**

## Recommended Posts:

- Goldman Sachs Interview Experience | Set 7
- Goldman Sachs Interview Experience
- Goldman Sachs Interview Experience
- Goldman Sachs Interview Experience | Set 43
- Goldman Sachs Interview Experience | Set 51
- Goldman Sachs Interview Experience | Set 38
- Goldman Sachs Interview Experience | Set 48
- Goldman Sachs Interview Experience | Set 5
- Goldman Sachs Interview Experience | Set 6
- Goldman Sachs Interview Experience | Set 41
- Goldman Sachs Interview Experience | Set 19
- Goldman Sachs Interview Experience | Set 40
- Goldman Sachs Interview Experience | Set 49
- Goldman Sachs Interview Experience
- Goldman Sachs Interview Experience | Set 23 (2+ years Experience for Java Developer Role)

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.