Price Deviation Alerts
Updated
Problem statement
A trading desk compares each stock's current price with a reference price. Stock i has ticker tickers[i], current price prices[i] and reference price referencePrices[i]. Prices are in cents.
The deviation of stock i is (prices[i] - referencePrices[i]) / referencePrices[i] * 100 percent. A stock raises an alert when the absolute value of its exact deviation, before any rounding, is at least thresholdPercent.
For each stock that raises an alert, in input order, build the message <ticker> Equity is trading <sign><percent>% away from its reference price. Here <sign> is + if the price is above the reference price and - if it is below, and <percent> is the absolute deviation rounded to two decimal places, with halves rounded up, always written with exactly two digits after the decimal point (for example 5.50 or 12.00).
Return the messages. Return an empty array if no stock raises an alert.
Function
priceMoveAlerts(tickers: String[], prices: int[], referencePrices: int[], thresholdPercent: int) → String[]Examples
Example 1
tickers = ["XYZ","ABC","QRS"]prices = [10550,9800,20200]referencePrices = [10000,10000,20500]thresholdPercent = 2return = ["XYZ Equity is trading +5.50% away from its reference price","ABC Equity is trading -2.00% away from its reference price"]XYZ is 550 cents above 10000, which is 5.5%. ABC is 200 below 10000, exactly 2%, which meets the threshold. QRS is 300 below 20500, about 1.46%, so it raises no alert.
Example 2
tickers = ["AAA","BBB"]prices = [8090,7910]referencePrices = [8000,8000]thresholdPercent = 1return = ["AAA Equity is trading +1.13% away from its reference price","BBB Equity is trading -1.13% away from its reference price"]Both stocks are 90 cents away from 8000, exactly 1.125%. The half is rounded up for both, so the messages show +1.13% and -1.13%.
Example 3
tickers = ["XYZ"]prices = [10100]referencePrices = [10000]thresholdPercent = 5return = []The stock is only 1% above its reference price, below the 5% threshold, so there are no alerts.
Constraints
1 <= tickers.length <= 104prices.length == referencePrices.length == tickers.length1 <= tickers[i].length <= 5tickers[i]consists of uppercase English letters.1 <= prices[i], referencePrices[i] <= 1071 <= thresholdPercent <= 100
More Jane Street interview questions
- Product Profit SummaryOA · Seen Sep 2026
- Cheating CodemakerOA · Seen Mar 2026
- Bond Haircut by Ratings and MaturityOA · Seen Aug 2024
- Currency Haircut with FX ForwardsOA · Seen Aug 2024
- Transform StringOA · Seen Jul 2024
- Trade Blotter Summary by TickerOA · Seen Jun 2021
- Biggest Daily Move and Longest Rising StreakOA · ONSITE INTERVIEW · Seen Apr 2021
- Transaction Fees by InstrumentOA · Seen Mar 2018
- Maximum-Scoring Consecutive Tree LevelsPHONE SCREEN · Seen Nov 2026
- Tree Selection and VisibilityPHONE SCREEN · Seen Nov 2026
Similar questions at other companies
- Count Multiples of Three with Two SevensHudson River Trading · OAHudson River Trading interview questions
- Closest ColorTwo Sigma · OATwo Sigma interview questions
- Maximum Equal Parts for PrefixesAmazon · OA
- Most Cost-Effective MachineCapital One · ONSITE INTERVIEWCapital One interview questions
- Add Signed Character ArraysByteDance · PHONE SCREENByteDance interview questions
- Eight-Direction Keyboard Typing TimeBenchling · PHONE SCREENBenchling interview questions
- Total Cost Against the Lowest Earlier PricePayPal · OAPayPal interview questions
- Count User Mentions in Chat MessagesRamp · OARamp interview questions
- Count Valid Square PairsAuxoAI · OA
- Picked Player Who LostSusquehanna International Group (SIG) · OASusquehanna International Group (SIG) interview questions
Interview reports that mention this question
Jane Street interview experiences
- Jane Street TDO UK and Hong Kong: 22 Experiences (Part 10 of 10)
- Jane Street TDOE US Final Round: 11 Experiences (Part 5 of 10)
- Jane Street TDO Phone Math Round: 26 Experiences (Part 9 of 10)
- Jane Street TDOE UK Phone Screen: 15 Experiences (Part 4 of 10)
- Jane Street TDOE UK Coding Round: 15 Experiences (Part 3 of 10)