Arbitrage with Three Assets and Three States
Updated
Problem statement
A market has three assets and three possible states tomorrow: up (index 0), flat (index 1) and down (index 2). Asset i costs prices[i] today, and one unit of it pays payoffs[i][s] tomorrow if state s happens.
You may hold any real amount h[i] of each asset, including negative amounts (short selling). Such a portfolio costs h[0] × prices[0] + h[1] × prices[1] + h[2] × prices[2] today and pays h[0] × payoffs[0][s] + h[1] × payoffs[1][s] + h[2] × payoffs[2][s] in state s.
An arbitrage is a portfolio that costs at most 0 today, never pays a negative amount, and either costs less than 0 or pays more than 0 in at least one state.
Return true if an arbitrage exists, and false otherwise.
Function
hasArbitrage(prices: int[], payoffs: int[][]) → booleanExamples
Example 1
prices = [100,80,60]payoffs = [[80,120,120],[100,100,40],[40,120,40]]return = falseThese are the interview bonds. Look for state prices q0, q1, q2, the cost today of receiving $1 in just one state, that price all three bonds correctly:
80 q0 + 120 q1 + 120 q2 = 100
100 q0 + 100 q1 + 40 q2 = 80
40 q0 + 120 q1 + 40 q2 = 60The solution is q0 = 8/19, q1 = 5/19, q2 = 11/38, all positive. Then every portfolio costs q0 × (up payoff) + q1 × (flat payoff) + q2 × (down payoff), so a portfolio that never pays a negative amount and sometimes pays more than 0 always costs more than 0. No arbitrage: false.
Example 2
prices = [100,80,40]payoffs = [[80,120,120],[100,100,40],[40,120,40]]return = trueThe same assets, but asset 2 (the third bond) costs 40. Now the flat state price is -1/38. Short 3 units of asset 0, short 2 units of asset 1 and buy 11 units of asset 2. Today you receive 300 + 160 - 440 = 20. Tomorrow the portfolio pays 0 if up, 760 if flat and 0 if down. That is an arbitrage: true.
Example 3
prices = [4,4,3]payoffs = [[10,10,0],[0,10,0],[0,0,10]]return = trueAsset 0 pays 10 if up or flat, asset 1 pays 10 if flat, and both cost 4. Buy one unit of asset 0 and short one unit of asset 1: it costs 0 and pays 10 if up and 0 otherwise. A free chance to win is an arbitrage, so the answer is true. Here the up state price is exactly 0.
Constraints
prices.length == 3,payoffs.length == 3andpayoffs[i].length == 31 <= prices[i] <= 10000 <= payoffs[i][s] <= 1000- The payoff table is invertible: its determinant is not
0.
More Susquehanna International Group (SIG) Phone Screen questions
- Dice Sum That Is a Multiple of mPHONE SCREEN · Seen Nov 2026
- Find Median from Data StreamPHONE SCREEN · Seen Nov 2026
- Painting Arcs to Nearest Neighbors on a CirclePHONE SCREEN · Seen Sep 2026
- Filter Movies by Inclusive Year RangePHONE SCREEN · Seen Jul 2026
- Best Single Reroll for Five DicePHONE SCREEN · Seen Feb 2026
- Catching the Bus to the MoviePHONE SCREEN · Seen Jan 2026
- Two Dice Summing to a TargetPHONE SCREEN · Seen Jan 2026
- Median of Uniform Draws in an IntervalPHONE SCREEN · Seen Oct 2025
- One Number Is the Average of the Other TwoPHONE SCREEN · Seen Jun 2025
- Which Coin Pattern Shows Up FirstPHONE SCREEN · Seen May 2025
Similar questions at other companies
- Logistic Regression DiagnosticsLinkedIn · PHONE SCREENLinkedIn interview questions
- 3D Grid Diagonal Walk ProbabilityApple · PHONE SCREENApple interview questions
- Implement Cross-Entropy LossOpenAI · PHONE SCREENOpenAI interview questions
- Best Starting Cell for Restaurant DistanceDoorDash · PHONE SCREENDoorDash interview questions
- Column and Row Parallel Linear LayersNVIDIA · PHONE SCREENNVIDIA interview questions
- Rotate ImageTokopedia · PHONE SCREENTokopedia interview questions
- Rotate ImageSambaNova Systems · PHONE SCREENSambaNova Systems interview questions
- Range of a Third CorrelationTower Research Capital · PHONE SCREEN
- Choose the Next Minesweeper ActionRunloop · PHONE SCREEN
- Best-Fit Plane Normal from 3D PointsThe Voleon Group · PHONE SCREEN