Order Latency Summary Statistics
Updated
Problem statement
A trading system sends orders to an exchange and logs each order in the orders table. latency_us is how long the exchange took to reply to the order, in microseconds. Some orders never got a reply time, so their latency_us is NULL (<NA> in Pandas).
Drop the orders with a missing latency_us. Then, for each symbol that still has at least one order, return one row with these columns, in this order, describing its latency_us values:
symbolcount: the number of orders with a reply time.mean: the average.std: the sample standard deviation, which divides bycount - 1. It isNULL(<NA>,NaNorNonein Pandas) whencountis1.min: the smallest value.p25,medianandp75: the 25th, 50th and 75th percentiles. When a percentile falls between two sorted values, use linear interpolation: forqequal to0.25,0.5or0.75, the percentile sits at positionq * (count - 1)in the sorted list, counting from0.max: the largest value.
A symbol whose orders all have a missing latency_us does not appear in the result. If no order has a reply time, return an empty table with these nine columns. Return the rows in any order. Each number is accepted when it is within 0.0001 of the exact value, and count may be a whole number such as 4 or 4.0.
Table schema
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
orders
One row per order sent to the exchange.
| Column | Type | Nullable | Description |
|---|---|---|---|
| order_idPK | Integer | No | Unique order ID. |
| symbol | Text | No | Stock symbol, for example 'AAPL'. |
| latency_us | Integer | Yes | Microseconds until the exchange replied, or NULL when no reply time was logged. |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| symbol | Text | No | — |
| count | Decimal | No | — |
| mean | Decimal | No | — |
| std | Decimal | Yes | — |
| min | Decimal | No | — |
| p25 | Decimal | No | — |
| median | Decimal | No | — |
| p75 | Decimal | No | — |
| max | Decimal | No | — |
Row order: any order is accepted. Numeric tolerance: 0.0001.
Constraints
- The
orderstable has between1and1000rows. order_idvalues are unique.symbolhas 1 to 10 uppercase English letters.latency_usisNULLor an integer with0 <= latency_us <= 1000000.
More Hudson River Trading Online Assessment questions
- Count Palindrome Addition ChoicesOA · Seen Nov 2026
- Count Multiples of Three with Two SevensOA · Seen Oct 2026
- Recursively Expanded Shell Command CountsOA · Seen Oct 2026
- Rotate Matrix Regions Around the DiagonalsOA · Seen Oct 2026
- Maximum Diamond SumOA · Seen Oct 2026
- Smallest Most-Lit Street PositionOA · Seen Oct 2026
- Rearrange String by Alternating EndsOA · Seen Sep 2026
- Most Items Within Budget from a Start IndexOA · Seen Sep 2026
- Count Fancy NumbersOA · Seen Sep 2026
- Count Pieces After Othello MovesOA · Seen Sep 2026
Similar questions at other companies
- Build Taxi Driver Performance FeaturesBoston Consulting Group · OABoston Consulting Group interview questions
- Students Scoring Above AverageCapstone Investment Advisors · OA
- Bond Interest Summary Above 3%Wells Fargo · OAWells Fargo interview questions
- Employee Promotion OpportunitiesIntuit · OAIntuit interview questions
- Students and Their SubjectsBirla Pivot · OA
- Companies with Average Salary Above 40000AT&T · OAAT&T interview questions
- Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
- Companies Above a Salary ThresholdVerisk · OA
- Customer Resource Usage AnalysisIBM · OAIBM interview questions
- Customers Who Never OrderedAccenture · OAAccenture interview questions