Goldman Sachs Interview Question
AnalystsCountry: India
Interview Type: Written Test
x := Number of traders who deal in both derivative and crude oil but not fx
y := Number of traders who deal in both fx and derivative but not crude oil
z := Number of traders who deal in both fx and crude oil but not derivative
From this info:
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.
we can derive Number of traders who deal in two markets:
(36+32+39-8*3-37)/2=23 :=Number of traders who deal in two markets
Now we have three equations:
x=y-1 <= 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.
z+x-2=2y <= 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.
x+y+z=23 <= 23 is Number of traders who deal in two markets
By solving equations we get:
z=10
So 10 traders deal in both fx and crude oil but not derivative.
Let assume that someone who has solved the first half of their collabaration question got the answer 10(same as you).
So P=(10*x/2)+floor(y/4)=52, as long as x=10 and y=10
After that we have simple linear optimization problem which i solved on python by pulp library:
from pulp import *
xTC = pulp.LpVariable("xTC", 0,cat='Integer')
xTE = pulp.LpVariable("xTE", 0,cat='Integer')
xOC = pulp.LpVariable("xOC", 0,cat='Integer')
xOE = pulp.LpVariable("xOE", 0,cat='Integer')
xMC = pulp.LpVariable("xMC", 0,cat='Integer')
xME = pulp.LpVariable("xME", 0,cat='Integer')
xLC = pulp.LpVariable("xLC", 0,cat='Integer')
xLE = pulp.LpVariable("xLE", 0,cat='Integer')
problem = pulp.LpProblem('0',pulp.LpMaximize)
problem += xLE, "Функция цели"
problem += xLC+xLE >= 50, "1"
problem += xLC+xLE <= 175, "2"
problem += xTC+xTE <= 175, "3"
problem += xTC+xTE >= 50, "4"
problem += xOC+xOE <= 175, "5"
problem += xOC+xOE >= 50, "6"
problem += xMC+xME <= 175, "7"
problem += xMC+xME >= 50, "8"
problem += xOE== xOC*0.45/0.55, "9"
problem += xTE== xTC*0.45/0.55, "10"
problem += xME== xMC*0.45/0.55, "11"
problem += xTC+xOC+xMC+xLC == 260, "12"
problem += xTC+xOC+xMC+xLC+xTE+xOE+xME+xLE == 500, "13"
problem.solve()
problem2 = pulp.LpProblem('0',pulp.LpMinimize)
problem2 += xLE, "Функция цели"
problem2 += xLC+xLE >= 50, "1"
problem2 += xLC+xLE <= 175, "2"
problem2 += xTC+xTE <= 175, "3"
problem2 += xTC+xTE >= 50, "4"
problem2 += xOC+xOE <= 175, "5"
problem2 += xOC+xOE >= 50, "6"
problem2 += xMC+xME <= 175, "7"
problem2 += xMC+xME >= 50, "8"
problem2 += xOE== xOC*0.45/0.55, "9"
problem2 += xTE== xTC*0.45/0.55, "10"
problem2 += xME== xMC*0.45/0.55, "11"
problem2 += xTC+xOC+xMC+xLC == 260, "12"
problem2 += xTC+xOC+xMC+xLC+xTE+xOE+xME+xLE == 500, "13"
problem2.solve()
print ("Result:")
s1=[]
s2=[]
for variable in problem.variables():
print (variable.name, "=", variable.varValue)
s1.append(variable.varValue)
print(s1[0]/s1[1])
print ('m>n' if s1[0]/s1[1] < 0 else 'm<n')
for variable in problem2.variables():
print (variable.name, "=", variable.varValue)
s2.append(variable.varValue)
print(s2[0]/s2[1])
print ('m>n' if s2[0]/s2[1] < 0 else 'm<n')
which give as answer like this
Result:
xLC = 18.0
xLE = 42.0
xMC = 66.0
xME = 54.0
xOC = 88.0
xOE = 72.0
xTC = 88.0
xTE = 72.0
0.42857142857142855
m<n
P.S. i'm just 2 weeks into programming so my code is far away from ideal, it's given just to solve the question asked.
for first question:
only Fx traders + only Derivative traders + only crude oil traders = 37
fx traders = 36
derivative traders = 32
crude oil traders = 39
8 traders deal in all three.
===============================
traders deal only in Fx + another market = 36-8 = 26
traders deal only in Derivative + another market = 32-8 = 24
traders deal only in Crude Oil + another market = 39-8 = 31
fx derivative crude
| | |
| | |
------------------------------------------------------
| |
X+1 X
fx derivative crude
| | |
| | |
------------------------------------------------------
| | |
Y | |
---------------------------
|
X
X+Y = 2(X+1)-2
Y=X
Thus
(X+1)+X+X = 26+24+31-37
3X+1 = 46
X = 15
Since X = Y, number of traders deal with Fx and Crude Oil is 15.
traders deal only in Fx + another market = 36-8 = 26
WRONG 36-8=28
then
X+Y = 2(X+1)-2
Y=X wrong
should be
X+Y-2=2(X+1)
Y=X+4
then
(X+1)+X+X=26+24+31-37 WRONG
should be
(X+1)+X+X+4 = (28+24+31-37)/2
3X+5=23
X=6
Y=6+4=10
ANSWER 10
36-8 = 26 (typo error while writing here) but I used it as 28 for solution.
thats why 3X+1 = 46
Is that confirmed answer?
if you were right then from your answer it would be:
15 - numbers of traders in fx&oil simultaneously
15 - numbers of traders in derivatives&oil simultaneously
16 - numbers of traders in derivatives&fx simultaneously
then total number of traders who work in more than one market simultaneously is(without 37 traders who trade only in one market):
fx=15+16+8=39
oil=15+15+8=38
derivatives=15+16+8=39
even without these 37 traders you have more stuff working than given in problem.
please recheck it once more.
x := Number of traders who deal in both derivative and crude oil but not fx
y := Number of traders who deal in both fx and derivative but not crude oil
z := Number of traders who deal in both fx and crude oil but not derivative
From this info:
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.
we can derive Number of traders who deal in two markets:
(36+32+39-8*3-37)/2=23 :=Number of traders who deal in two markets
Now we have three equations:
x=y-1 <= 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.
z+x-2=2y <= 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.
x+y+z=23 <= 23 is Number of traders who deal in two markets
By solving equations we get:
z=10
So 10 traders deal in both fx and crude oil but not derivative.
Let assume that someone who has solved the first half of their collabaration question got the answer 10(same as you).
So P=(10*x/2)+floor(y/4)=52
After that we have simple linear optimization problem which i solved on python by pulp library:
- Raksan November 18, 2019