FastPrepSignal Pings
Problems/Signal Pings

Signal Pings

Fortinet logoFortinet● HardOA

Updated Sep 2026

QuestionFunctionExamples

Problem statement

Special thanks: Endless thanks to the friend who so generously shared the problem source! 🌸

You have an array of n binary signals, where each signal initially has a value of 0. There are n different pings made to these signals, changing their value from 0 to 1. The i ping affects the signal at index ping[i].

After each ping, the processor sorts the array by performing sweeps from left to right, swapping adjacent elements where signal[i] = 1 and signal[i + 1] = 0. The processor stops when no swaps are made in a sweep.

Determine the number of sweeps required after each ping to sort the array.

Note: Each signal is only pinged once.

Function

getRequiredSweeps(ping: int[]) → int[]

Examples

Example 1

ping = [1, 2, 4, 3]return = [2, 3, 3, 1]
Example 1 illustration

More Fortinet interview questions

  • Checksum AggregatorOA · Seen Jun 2025
  • K-Means ClusteringOA · Seen Jun 2025
  • Madam C.J. Walker's Business PlanOA · Seen Jun 2025
  • Maximize Beautiful SubstringsOA · Seen Mar 2025

Similar questions at other companies

  • Deployment Window SchedulerStripe · OAStripe interview questions
  • Power Cell BankOptiver · OAOptiver interview questions
  • Credit Accounts with Scheduled TransfersAirbnb · OAAirbnb interview questions
  • Four-Level Banking System with Scheduled PaymentsZipRecruiter · OAZipRecruiter interview questions
  • IPO Share AllocationTwo Sigma · OATwo Sigma interview questions
  • Task Management SystemCoinbase · OACoinbase interview questions
  • Four-Player Trick-Taking Card Game SimulationScale AI · OA · PHONE SCREENScale AI interview questions
  • Task Management SystemAnthropic · OAAnthropic interview questions
  • Progressive Parcel Tracking OperationsKlaviyo · OAKlaviyo interview questions
  • Initial Public OfferingPoint72 · OAPoint72 interview questions
All Fortinet interview questionsSee Fortinet hiring insights
Saved
class Solution {
    public int[] getRequiredSweeps(int[] ping) {
      // write your code here
    }

}
Checking account…