Goldman Sachs Interview Questions
- 1of 1 vote
AnswersYou have an integer array. Starting from arr[startIndex], follow each element to the index it points to. You continue to do this until you find a cycle. Return the length of the cycle. If no cycle is found return -1
- rock January 26, 2021 in United States
forexample {1, 0}, 0) => 2
{1, 2, 0}, 0) => 3| Report Duplicate | Flag | PURGE
Goldman Sachs Senior Software Development Engineer Java - 3of 3 votes
AnswersAsked in Google - 2020, Goldman Sachs - 2020
- Gaurav Sohaliya August 22, 2020 in India
Given two Array.
A = [1,3,4,2,5,6] B = [3,4,6,5,7]
we have to remove 3,1,2,6 and Insert 6,7 to make A equal to B.
we can delete and insert any element at anywhere from first array and make that array same as second array. Output is Minimum Number of elements required to be insert in first array.
constraints:
1 <= First Array Size <= 10^5
1<= Second Array SIze <= 10^5
1 <= firstarray[i] <= 10^9
1 <= secondarray <= 10^9
second array consist of distinct element.
Note : it is same as edit distance but here our constraints are 10^5.| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Arrays - 0of 0 votes
AnswersA new senior trader has been invited to a gathering of traders from all around London. She goes there and tries to meet as many traders as she can. When she meets someone she generally remembers them by the market sector they deal in.
- jaryya@hawk.iit.edu November 12, 2019 in India
36 traders deal in the fx market.
32 traders deal in the derivative market.
39 traders deal in the crude oil market.
37 traders deal in only one market.
8 traders deal in all the three markets.
All traders deal in atleast one of the three markets.
Number of traders who deal in both derivative and crude oil but not fx was one less than the number of traders who deal in both fx and derivative but not crude oil.
The sum of the number of traders who deal in both fx and crude oil but not in derivative and in both crude oil and derivative but not fx was two greater than twice the number of traders who deal in both fx and derivative but not crude oil.
How many traders deal in both fx and crude oil but not derivative?
Find someone who has solved the first half of their collaboration question and ask them for the solution they got. You both have to solve the below question together and then come to us with your solution.
Let x be your result and y be the result for your partner
Then, P = (10* x/2)+ floor(y/4). Use p as an input to the next question.
According to the recent report published by the Human Resource team at a FinTech startup, the number of employees is 500 at present. They have been divided into four teams, named Technology, Operations, Management and Legal.
The report also tells that out of these employees, P% are campus recruits while the remaining have prior work experience. The number of employees in each team can be no less than 50 and no more than 175.
The following partially filled table shows the information about the break-up of the employees in terms of campus recruits or with work experience in the four teams.
Team Campus Recruit Work Experience
Technology 55% -
Operations - 45%
Management 55% -
Legal m% n%
What can be said about the relative values of ‘m’ and ‘n’?
a. m>n b. m<n c. m>=n d. m<=n| Report Duplicate | Flag | PURGE
Goldman Sachs Analyst - 0of 0 votes
AnswersWas asked at the Grace Hopper Celebration India (Bangalore) career fair at the GS booth.
- jaryya@hawk.iit.edu November 12, 2019 in India
How many golf balls are going to fit in the Boeing manufacturing warehouse?
My response:
Estimation problem, volume of the warehouse is approx 13.5*10^5 m^3 and vol. of each golf ball is 4/3*3.14*0.002^3 The space between every 8 golf balls is ~ equal to 1 golf ball...| Report Duplicate | Flag | PURGE
Goldman Sachs Analyst - 0of 0 votes
AnswersA car has to be given on rent. Different people come and ask for it for interval [s,e] and offer some price p. To whom shall the car be given in order to earn maximum.
- Ankita August 22, 2018 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Coding - 0of 2 votes
AnswersI am surprised by this GS question.I thought this is one of the classic number theory partition problem which is so hard that the best algorithm is approximation one.
- hprem991 February 22, 2018 in United States
Given value, find all possible combination of ways which equals to that sum.| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer Coding - 0of 0 votes
Answersfrom robot movement tell final position of robot...
- kishanvadalia.vadalia January 09, 2018 in India
testcases:
"ULDLLUDL"
"UP 2xDOWN LEFT 4xRIGHT"| Report Duplicate | Flag | PURGE
Goldman Sachs Software Developer - 4of 4 votes
AnswersYou have given height array of array. Generate the original array.
- sandeepmnit35 November 20, 2017 in India
Input: [6,3,0,2,2,0,0]
Output : [ 1,5,7,3,2,6,4]
A[i] value in input array is the number of greater element on right side.| Report Duplicate | Flag | PURGE
Goldman Sachs Developer Program Engineer Algorithm - 0of 0 votes
AnswersHow to print nested array ?
- sandeepmnit35 November 20, 2017 in India
Input : [1, 5, 8, [9, 10, 24, 20, [39, 48], 89], 105, 99]
Output : 1, 5, 8, 9, 10, 24, 20, 39, 48, 89, 105, 99.
Which data structure you will use to store the values?| Report Duplicate | Flag | PURGE
Goldman Sachs Developer Program Engineer Algorithm - 3of 5 votes
AnswersGiven two sorted linked lists, how can you combine them into one big sorted list? Do not create additional nodes.
- kredible November 12, 2017 in Singapore| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Java - 0of 0 votes
AnswersThere is going to be a sale during this month. You are interested in a particular item and you found that different Vendors have different prices during different time periods. You collected the following information:
Vendor => (start date, end date, price) both sides inclusive A => (1, 5, $20) B => (3, 6, $15) C => (2, 8, $25) D => (7, 12, $18) E => (1, 31, $22)
As you can see, there are conflicting entries. You need to print out a non-conflicting schedule of prices, taking the best price from each period:
- kredible November 12, 2017 in Singapore
e.g.
(1, 2, $20), (3, 6, $15), (7, 12, $18), (13, 31, $22)| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Java - 1of 1 vote
AnswersGiven a list of currency exchange rates like this:
EUR/USD => 1.2
USD/GBP => 0.75
GBP/AUD => 1.7
AUD/JPY => 90
GBP/JPY => 150
JPY/INR => 0.6
write a methoddouble convert(String sourceCurrency, double amount, String destCurrency);
For example, convert(EUR, 100, INR)
- kredible November 12, 2017 in Singapore
The method should minimize the number of intermediate conversions.| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Java - 0of 0 votes
AnswersGiven two sorted integer arrays, find the median element. Note that for an even sized collection, median element is to be defined as the average of the central two elements.
- NoOne September 25, 2017 in India| Report Duplicate | Flag | PURGE
Goldman Sachs Software Architect Algorithm - 2of 2 votes
AnswersSingleton Design pattern. How you make it double ton(in even call of getInstance() first object should be return and odd call of getInstance() second instance should be return). Make it triple ton.
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs SDE-2 Software Design - 1of 1 vote
AnswersPrint series 010203040506. Using multi-threading 1st thread will print only 0 2nd thread will print only even numbers and 3rd thread print only odd numbers.
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs SDE-2 Threads - 0of 0 votes
AnswersGiven a remote having 0-9 digits, plus button (to increase channel), minus (to decrease) and previous channel button (to go to previous channel). We were given 2 numbers stating start and end channel number and an array having various channel numbers. The task was to go to all channel numbers given in array with minimum number of clicks.
- neer.1304 August 31, 2017 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Backend Developer Algorithm - 2of 2 votes
AnswersI was given a questions during an interview which I was not able to solve, please help me in finding the solution.
Ques : - Divide the set in two partition such that both the partition has minimum difference of their sum. If we add an element to the left subset during partitioning than the value of that number will automatically increases by 1, but it will not increase by 1 if I add it to the right side. Find the minimum difference between both the subsets : -ex :- {1,2,3,4,5} leftSubset = {3,4} , rightSubset = {1,2,5} effective sum of leftSubset = 3+4+2(number of elements) effective sum of rightSubset = 1+2+5 = 8 difference of left and right = (9-8)=1 =, min difference
solution : (1,2,3} {4,5}
- himanshu.tomar05 August 21, 2017 in India| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer Algorithm - 0of 0 votes
AnswersJamie is walking along a number line that starts at point 0 and ends at point n. She can move either one step to the left or one step to the right of her current location , with the exception that she cannot move left from point 0 or right from point n. In other words, if Jamie is standing at point i,she can move to either i-1 or i+1 as long as her destination exists in the inclusive range [0,n]. She has a string ,s , of movement instruction consisting of the letters 1 and r , where 1 is an instruction to move one step left and r is an instruction to move one step right.
- Ashish Dass May 01, 2017 in India for Java
Jamie followed the instructions in s one by one and in order .For Example if s=‘rrlr’,she performs the following sequence of moves :one step right ->one step right ->one step left -> one step right .Jamie wants to move from point x to point y following some subsequence of string s instruction and wonders how many distinct possible subsequence of string s will get her from point x to point y. recall that a subsequence of a string is obtained by deleting zero or more characters from string .
it has four parameters
A String , s giving a sequence of eduction using the characters l( i.e. move left one unit ) and r (i.e. move right one unit)
An integer n, denoting the length of the number line.
An integer x, denoting jamie’s starting point on the number line
An integer y , denoting Jamie’s enidng point on the number line.
The function must return an integer denoting the total number of distinct subsequence of string s that will lead Jamie from point x to point y as this value cab be quite large .
Sample Input
rrlrlr
6
1
2
out put =7| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Algorithm - 1of 1 vote
AnswersWrite a Java program to get the count of ipv6 address present in the provided address range.
- sant November 16, 2016 in United States
Ex: if we provide ipv6 address range 2001:db8::/124 then the program should display the range contains 16 IP's.Starting from 2001:db8:: to 2001:db8:0000:0000:0000:0000:0000:000f.| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer Network - 0of 0 votes
AnswersWe tend to use computer to solve practical problems that actually earns or save dollars. Here is something that happens across the stock exchanges : people buy and sell stocks.
- NoOne October 15, 2016 in India
We generally use automated intelligent systems to buy and sell stocks. That part is too much mathematics, and beyond scope of this interview. There is another part. Suppose the system issues a buy order : buy 1000 Microsoft stock. Now, there are more than 1 ( in fact 10 ) active exchanges from where we can buy MSFT. There is a slight price delta, which keeps changing over time. There is another problem. In each stock exchange, prices are stacked, that is :
1. For first 100 stocks prices are 55$.
2. Next 200 stocks, prices are 55.2$.
... etc, and you got the idea. Even this stacks are changing over time.
Thus, here is the problem to solve. Design and implement a system such that one can buy n stocks with minimal price.
Also, in the same spirit, the same system should be able to sell n stocks with maximum payoff possible.
This is a non trivial problem, for Quant systems.
There are always k no of exchanges to hit.| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Algorithm Cache Computer Architecture & Low Level Computer Science Distributed Computing Large Scale Computing Math & Computation Software Design - 0of 0 votes
AnswersGiven a histogram chart with values say {5,4,3,6,0,1}. Get the total count required to completely melt the histogram. A column with value 5 has 5 blocks in it. Any block which has air on any of its side gets melted.
- abc_abc March 07, 2016 in United States
Sample 1
{5,4,3,6,0,1} - > {0,3,2,0,0,0}->{0,0,0,0,0,0} => count=2
Sample 2
{0,1,1,1,1,0} - > {0,0,0,0,0,0} => count=1| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer Arrays - 0of 0 votes
AnswerWhat is Static class in Java? What is singleton class? How are they different.
- Joey November 21, 2015 in India| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer - 0of 0 votes
AnswersIs java pass by value or pass by reference?
- Joey November 21, 2015 in India
Then he asked various question related to this.
What if i pass integer, array list or object will the change reflect in the original function.
In case of object will we have different behavior when i set it to null in the called function or when I call its method(setName("") for example ).| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Java - 1of 1 vote
AnswersYou toss a fair coin 400 times. What’s the probability that you get at least 220 heads? Round your answer to the nearest per cent.
- tihor February 01, 2015 in India for Strats| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer Math & Computation - 0of 0 votes
Answersin one string array{'Good',''word','good','woRd'...}
- pogiriykirankumar January 10, 2015 in India
how can i print like Good--2
Word-2 times appeared in the array.even Good and good are different in case sensitive.| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer - 0of 2 votes
AnswersIN phone directory,i have like below details
- pogiriykirankumar January 10, 2015 in India
ABc---123
bcd--345
cda--523
abc--678.
So if i want to see Abc person phone numbers we should get the both the numbers,how can we implement this in java| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer - 2of 2 votes
AnswersYou have String array like{'cat','good','tac','act''....} like some 1000 words.
- pogiriykirankumar January 10, 2015 in India
So if i give input tac ,output should be cat and act..
How can we implement with less complexity| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Algorithm