Reported July 2026
Visasimulation

Signal Pings

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

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

Visa's Signal Pings OA, reported in July 2026, looks like a simulation problem until you see n. Re-running a bubble sort after every ping is O(n^3) in the worst case, and it dies on large inputs. The real task is to predict the sweep count without sorting anything. It's a bubble sort on a binary array in disguise, and the answer has a clean formula. If you blank on it during the live assessment, StealthCoder runs invisibly on your desktop and can hand you the approach while you type. Here's the pattern so you don't need it.

The problem

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 values from 0 to 1. The i-th 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[j] = 1 and signal[j + 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.
Complete the function getRequiredSweeps. It accepts the integer array ping, where each value identifies the signal called by that ping, and returns an integer array containing the number of sweeps required after each ping.

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

Examples
Example 1
ping = [1, 2, 4, 3]
return = [2, 3, 3, 1]
Here, n = 4. The sweep counts after each ping are:
Sweep counts for each pingPingOperations required to process signalsSignal after the ping
1One sweep sorts the array into [0, 0, 0, 1]. One additional sweep is run with no swaps, for a total of 2 sweeps.[1, 0, 0, 0]
2Two sweeps sort the array. One additional sweep is run with no swaps, for a total of 3 sweeps.[1, 1, 0, 0]
3Two sweeps sort the array. One additional sweep is run with no swaps, for a total of 3 sweeps.[1, 1, 0, 1]
4The signal is already sorted, so one sweep with no swaps is sufficient.[1, 1, 1, 1]
Therefore, return [2, 3, 3, 1].

Reported by candidates. Source: FastPrep

Pattern and pitfall

Bubble sort on 0/1 moving 1s to the right. Each sweep carries a 1 right until it hits another 1, and every 1 that still has a 0 to its right gets one step closer to place. The number of sweeps that do swaps equals the max over all 1s of (number of 0s to its right, adjusted for queuing behind other 1s). Simplest form: walk the array left to right, keep a count of zeros seen so far, and for each 1 set time = max(time + 1, zerosBefore). Wait, with 1s moving right, flip it: process from the right, tracking zeros to the right of each 1. Then add one for the final no-swap sweep. Across pings, positions get set to 1 incrementally, so you need a data structure like a Fenwick tree or a clever incremental update rather than recomputing the whole array. The pitfall is forgetting the extra clean sweep, which is why the sorted case returns 1, not 0. Brute force fails on size. If the formula slips away mid-OA, StealthCoder is your hedge.

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 Signal Pings 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

⏵ The honest play

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

Visa 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.

Signal Pings FAQ

What's the trick in Visa's Signal Pings problem?+

Don't simulate the sweeps. Bubble sort on a binary array has a closed form: each 1 needs to travel past the 0s on its right, and 1s queue behind each other. Compute the max finishing time over all 1s, then add one for the final sweep with no swaps.

Why does the answer include one extra sweep?+

The processor only stops after a sweep that makes zero swaps. So if k sweeps are needed to sort, the total is k + 1. That's why an already sorted array, like the last ping in the example, returns 1 instead of 0.

Why can't I just brute force it?+

You have n pings, and each one triggers a bubble sort that can take up to n sweeps of n comparisons. That's roughly n^3 total. With large n it times out, so you need an incremental or formula-based approach.

What data structure helps across the pings?+

Since each signal flips from 0 to 1 exactly once, you can maintain counts of 1s and 0s by position with a Fenwick tree or similar prefix structure. That lets you update the sweep count after each ping in about O(log n) instead of rescanning.

How do I prep for this in 48 hours?+

Work a small example by hand, like [1,2,4,3] from the problem, and trace the array after each ping. Find the pattern for how many sweeps each 1 needs. Then code the O(n) formula for one array and extend it to incremental updates.

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

OA at Visa?
Invisible during screen share
Get it