FastPrepPressure Chamber Linear Interpolation
Problems/Pressure Chamber Linear Interpolation

Pressure Chamber Linear Interpolation

SpaceX logoSpaceX● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a SpaceX phone screen. The report describes a map from velocity to chamber pressure, and the original author says to use linear interpolation between known points. It does not give the full table, the function signature, the limits, or what to do outside the range. Our version is about 82% the same as the reported idea.

Pressure Chamber Linear Interpolation

A pressure chamber must follow target pressures as a vehicle's velocity changes during liftoff. The task provides known velocity-to-pressure points and asks for the target pressure at another velocity without introducing a sudden jump.

Function Contract

For this exercise, assume velocities and pressures describe aligned known points. The velocities are strictly increasing, and queryVelocity lies between the first and last known velocities, inclusive.

If queryVelocity equals a known velocity, return its pressure. Otherwise, find the two neighboring known velocities and return the pressure obtained by linear interpolation between their aligned pressure values.

Function

interpolateChamberPressure(velocities: double[], pressures: double[], queryVelocity: double) → double

Examples

Example 1

velocities = [0.0,100.0]pressures = [120.0,300.0]queryVelocity = 50.0return = 210.0

50 is halfway between velocities 0 and 100, so its pressure is halfway between 120 and 300: 210.

Example 2

velocities = [0.0,25.0,70.0]pressures = [100.0,150.0,330.0]queryVelocity = 25.0return = 150.0

The query exactly matches the second known velocity, so return its aligned pressure 150.

Example 3

velocities = [0.0,20.0,50.0]pressures = [100.0,140.0,200.0]queryVelocity = 35.0return = 170.0

35 is halfway between 20 and 50, so interpolate halfway between pressures 140 and 200.

Constraints

  • 2 ≤ velocities.length == pressures.length ≤ 100,000
  • All input values are finite doubles with absolute value at most 10^9.
  • velocities is strictly increasing.
  • velocities[0] ≤ queryVelocity ≤ velocities[velocities.length - 1]
  • Answers within 10^-6 of the exact interpolated pressure are accepted.

More SpaceX interview questions

  • Starlink Beam PlannerOA · PHONE SCREEN · Seen Nov 2026
  • Timestamped Telemetry Stream DifferencesPHONE SCREEN · Seen Sep 2026
  • Number of IslandsPHONE SCREEN · Seen Aug 2026
  • Number of Islands IIPHONE SCREEN · Seen Aug 2026
  • Button Combination DetectorPHONE SCREEN · Seen Feb 2026
  • Speed to Pressure LookupPHONE SCREEN · Seen Mar 2025
  • Simplified Time-Based Key-Value StorePHONE SCREEN · Seen Nov 2023
  • Rocket Component CostONSITE INTERVIEW · Seen Aug 2025
  • DNA Sequence MatchOA · Seen Apr 2025
  • Find the Duplicate NumberONSITE INTERVIEW · Seen Jan 2021

Similar questions at other companies

  • Random Pick with Weight Using Recorded DrawsGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Minimum of a Convex FunctionRippling · PHONE SCREENRippling interview questions
  • Count Centaur Friend RequestsMeta · PHONE SCREENMeta interview questions
  • Percentile and Boundary QueriesDatadog · PHONE SCREENDatadog interview questions
  • Floor Square Roots for an ArrayWells Fargo · OAWells Fargo interview questions
  • Maximum Alloy Production Within BudgetMicrosoft · OAMicrosoft interview questions
  • Linear InterpolatorTwo Sigma · OATwo Sigma interview questions
  • Koko Eating BananasTekion · ONSITE INTERVIEWTekion interview questions
  • Rock JumpingIMC Trading · OAIMC Trading interview questions
  • Koko Eating BananasAmazon · ONSITE INTERVIEW

Interview reports that mention this question

  • 2013–2026 SpaceX Full-Time OA / Interviews: 45 Experiences (Part 2 :)
  • SpaceX Software Engineer OA and Interviews: 27 Experiences
  • SpaceX Software Engineer C++ Technical Screen: 1 Experience

SpaceX interview experiences

  • SpaceX Full-Time Interview Cycle and Delayed Decision
  • SpaceX Experienced Engineer Full-Time Thirteen-Interview Process
  • SpaceX Senior Hardware Engineer Full-Time Interrupted Onsite
All SpaceX interview questionsSee SpaceX hiring insights
Saved
class Solution {
    public double interpolateChamberPressure(double[] velocities, double[] pressures, double queryVelocity) {
        // Write your code here.
    }

}
Checking account…