FastPrepSpeed to Pressure Lookup
Problems/Speed to Pressure Lookup

Speed to Pressure Lookup

SpaceX logoSpaceX● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a SpaceX phone screen. The report describes mapping a speed to the pressure at the lower end of its interval, and notes that the table may change. It does not give the actual table or a runnable function signature, so we supply arrays of breakpoints and pressures. We also say how a speed equal to a breakpoint works and what happens in the last interval. Our version is about 88% the same as the reported question.

Speed to Pressure Lookup

Write an algorithm that receives a speed and returns the corresponding pressure. Each speed interval uses the pressure associated with the smaller endpoint. For example, every speed from 0 up to, but not including, the next listed speed uses the pressure associated with 0.

Function Contract

For this exercise, assume speedBreakpoints is a strictly increasing list whose first value is 0, and pressures[i] is the pressure that begins at speedBreakpoints[i].

Return the pressure at the greatest breakpoint that is less than or equal to speed. A speed equal to a breakpoint uses that breakpoint's pressure. A speed above the final breakpoint uses the final pressure.

Function

lookupPressure(speedBreakpoints: int[], pressures: int[], speed: int) → int

Examples

Example 1

speedBreakpoints = [0,10,20,30]pressures = [100,95,80,60]speed = 7return = 100

The greatest breakpoint not exceeding 7 is 0, so the answer is pressures[0] = 100.

Example 2

speedBreakpoints = [0,10,20,30]pressures = [100,95,80,60]speed = 10return = 95

A speed equal to a breakpoint uses that breakpoint's pressure, so 10 maps to 95.

Example 3

speedBreakpoints = [0,10,20,30]pressures = [100,95,80,60]speed = 99return = 60

The speed is above the final breakpoint, so the final pressure applies.

Constraints

  • 1 ≤ speedBreakpoints.length == pressures.length ≤ 100,000
  • speedBreakpoints[0] == 0
  • 0 ≤ speedBreakpoints[i] ≤ 10^9
  • speedBreakpoints is strictly increasing.
  • -10^9 ≤ pressures[i] ≤ 10^9
  • 0 ≤ speed ≤ 10^9

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
  • Pressure Chamber Linear InterpolationPHONE SCREEN · Seen Jun 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

  • First Element Greater Than KMeta · PHONE SCREENMeta interview questions
  • Track New Values in Sorted OrderBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Price at Query TimestampsGoogle · PHONE SCREENGoogle interview questions
  • First Missing Number in a Consecutive ArrayArista Networks · OA · PHONE SCREENArista Networks interview questions
  • Messages in an Inclusive Timestamp RangeAttentive · PHONE SCREEN · ONSITE INTERVIEWAttentive interview questions
  • Target Sum Across Two Sorted ArraysSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Leftmost Binary Search MatchByteDance · PHONE SCREENByteDance interview questions
  • Count Occurrences in a Sorted ArrayAdobe · PHONE SCREEN · ONSITE INTERVIEWAdobe interview questions
  • Find the First Target IndexSuperhuman · PHONE SCREENSuperhuman interview questions
  • First Target IndexGrammarly · PHONE SCREEN

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 Starship Software Engineer Interview: 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 int lookupPressure(int[] speedBreakpoints, int[] pressures, int speed) {
        // Write your code here.
    }

}
Checking account…