FastPrepRolling Five-Second Flight-Distance Alerts
Problems/Rolling Five-Second Flight-Distance Alerts

Rolling Five-Second Flight-Distance Alerts

Skydio logoSkydio● MediumFULLTIMEPHONE SCREEN

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A first-hand Skydio phone screen gives the follow-up of alerting when a per-second coordinate stream moves one meter in the last five seconds. Window endpoint and zero-based-index conventions are explicit practice assumptions; the core matches at about 95%.

A drone reports one planar coordinate at each integer second. For every report index i > 0, compute the path length traveled during the most recent five seconds: sum the adjacent-segment lengths whose ending indices are from max(1, i - 4) through i.

Return every zero-based index where that rolling distance is at least threshold.

Function

rollingDistanceAlerts(coordinates: double[][], threshold: double) → int[]

Examples

Example 1

coordinates = [[0.0,0.0],[0.3,0.0],[0.6,0.0],[0.9,0.0],[1.2,0.0],[1.5,0.0]]threshold = 1.0return = [4,5]

At indices 4 and 5, the most recent four segments total 1.2 meters.

Example 2

coordinates = [[0.0,0.0],[0.1,0.0],[0.2,0.0]]threshold = 1.0return = []

No rolling window reaches one meter.

Constraints

  • 1 <= coordinates.length <= 100000.
  • Every coordinate has exactly two finite values.
  • 0 < threshold <= 1000000000.

More Skydio interview questions

  • Drone API Sliding-Window Rate LimiterPHONE SCREEN · Seen Jul 2024
  • Cumulative Flight-Distance AlertsPHONE SCREEN · Seen Apr 2024
  • Overlap-Safe Memory CopyPHONE SCREEN · Seen Aug 2022
  • Maximum Area of IslandPHONE SCREEN · Seen Oct 2021
  • Merge K Sorted ListsONSITE INTERVIEW · Seen Sep 2024

Similar questions at other companies

  • Maximum Visible DronesAnduril · PHONE SCREENAnduril interview questions
  • Sliding-Window Means with IEEE Special ValuesHeadlands Technologies · OAHeadlands Technologies interview questions
  • Fastest Average Speed over a Rolling KilometerOptiver · OAOptiver interview questions
  • Find Least Possible VulnerabilityAmazon · OA
  • Subarray Product Less Than KApple · PHONE SCREENApple interview questions
  • Dice-Walk Winning ProbabilityGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Logistic Regression with Gradient DescentYahoo · PHONE SCREENYahoo interview questions
  • Subarray Product Less Than KAngel One · PHONE SCREEN
  • Subarray Product Less Than KThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
  • Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
All Skydio interview questionsSee Skydio hiring insights
Saved
class Solution {
    public int[] rollingDistanceAlerts(double[][] coordinates, double threshold) {
        // write your code here
    }
}
Checking account…