Reported May 2025
Airtablebinary search

Approximate Percentiles

Reported by candidates from Airtable's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Airtable OA. Under 2s to a working solution.
Founder's read

Airtable's May OA included a percentiles problem, and you're probably wondering if it's a stats trick or an algorithm one. It's both. You'll get an unsorted array of numbers and need to compute percentiles without sorting the entire dataset or loading everything into memory. This is a streaming or partitioning problem dressed up as a stats question. StealthCoder will catch the edge cases you miss under pressure, especially around rounding and boundary conditions.

Pattern and pitfall

Percentiles are typically solved with sorting (O(n log n)), but the 'approximate' flag signals you should use quickselect or a heap-based approach to find k-th smallest elements in O(n) average time. The trick is recognizing that computing multiple percentiles is cheaper if you partition once, then find indices, rather than sorting and indexing. Common pitfall: using naive sorting and calling it done, or miscalculating the index formula (some use floor, some ceil, some interpolate). You need to nail the exact percentile definition the problem specifies. StealthCoder's real value here is providing the exact index formula and handling tied values correctly when you're live and can't afford to debug off-by-one errors.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Approximate Percentiles cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as kth largest element in an array. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Airtable's OA.

Airtable reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Approximate Percentiles FAQ

Is this a sorting problem or a statistics problem?+

It's algorithmic. You're finding k-th order statistics, not computing standard deviation. Sorting is the naive path. Quickselect (average O(n)) or heap selection is the intended pattern. The 'approximate' tag often hints that exact sorting is overkill.

What's the trick with multiple percentiles?+

Don't compute each percentile independently. Partition once, then locate multiple indices in the partitioned array. This saves redundant work. If asked for 25th, 50th, 75th percentiles, you're finding the 3 corresponding k values and extracting them from a single pass structure.

How do you handle the index formula?+

The problem defines it. Common variants: (p/100) * n, (p/100) * (n+1), or interpolation between two elements. Don't assume. Read the spec. Off-by-one errors here are common because candidates guess instead of confirming.

What if the input has duplicates or ties?+

Quickselect can return any element equal to the k-th value. If the problem requires a specific tie-breaking rule, you need to handle it explicitly. Many candidates skip this and lose edge case points.

How much can I optimize for space if memory is tight?+

Quickselect is O(1) space on average (in-place partitioning). A heap-based approach uses O(k) space for the k-th percentile. If the OA constrains memory, quickselect wins. If it asks for streaming data (percentiles over an unknown-length feed), heap is safer.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Airtable.

OA at Airtable?
Invisible during screen share
Get it