Reported September 2026
Abridgematrix

Flip, Invert, and Smooth a Binary Image

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

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

Abridge reportedly put this one in front of candidates in September 2026, and the whole thing hinges on one extra matrix. Flip each row, invert the bits, then smooth with a 3 x 3 floored average. It reads like two easy warmups glued together, but the glue is where people lose points. If you've got an OA invite and 48 hours, this is a matrix simulation problem, and the trap is writing smoothed values back into the same grid you're still reading from. StealthCoder is the safety net if you blank live, but you probably won't need it once you see the shape.

The problem

Given a rectangular binary matrix image, perform two transformations without modifying the input.
Flip every row horizontally, then invert each bit.
For each cell of that transformed matrix, compute the floor of the average of the cell and all valid neighbors in its surrounding 3 x 3 region.
Return the smoothed matrix. Every smoothing average must read from the complete flipped-and-inverted matrix, not from partially written output.

Function
flipInvertAndSmooth(image: int[][]) → int[][]

Examples
Example 1
image = [[0,0,0],[0,0,0],[1,0,0]]
return = [[1,1,1],[1,0,0],[1,0,0]]
Flipping and inverting produces [[1,1,1],[1,1,1],[1,1,0]]. Each result cell is the floored neighborhood average of that complete intermediate matrix.
Example 2
image = [[0,0],[0,0]]
return = [[1,1],[1,1]]
The first transformation produces all ones, and every valid neighborhood therefore averages to one.
Example 3
image = [[1]]
return = [[0]]
The single bit becomes zero; its one-cell neighborhood also averages to zero.

Constraints
1 <= image.length, image[i].length <= 200.
Every row has the same length.
Every cell is 0 or 1.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The data structure that matters is a second matrix. Build the transformed grid first: for each row, reverse it and XOR each bit with 1. Then allocate a fresh output grid and fill it by scanning every cell, summing the 3 x 3 neighborhood from the transformed grid only, counting valid neighbors as you go, and using integer division for the floor. The pitfall is in-place smoothing. If you overwrite cells while reading neighbors, later averages get corrupted, and the statement calls this out directly. Bounds checks are the second trap, since corners have 4 cells and edges have 6. Complexity is O(m*n) time and O(m*n) space, with 9 neighbor checks per cell. Because inputs are 0 or 1, the floored average only hits 1 when every cell in the neighborhood is 1. If you freeze during the live OA, StealthCoder can hand you the two-grid structure as a hedge.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Flip, Invert, and Smooth a Binary Image 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 for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ The honest play

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

Abridge reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Flip, Invert, and Smooth a Binary Image FAQ

How hard is the Abridge flip, invert and smooth problem really?+

Easy to medium. No fancy algorithm is needed. It's a matrix simulation with two passes. Most failures come from smoothing in place or botching the edge neighbor counts, not from logic you couldn't figure out in ten minutes.

What's the trick to avoid wrong answers?+

Keep the flipped-and-inverted matrix as its own grid and never write smoothed values into it. Write results into a separate output matrix. Every average then reads from the complete intermediate matrix, exactly as the problem requires.

How do I handle corners and edges in the 3 x 3 window?+

Loop the row offsets and column offsets from -1 to 1, skip any position outside the grid, and increment a counter for each valid cell you add. Divide the sum by that counter using integer division. Don't hardcode 9, 6, or 4.

Can I do the flip and invert in one pass?+

Yes. For each row, build the new row by reading from the end and writing 1 minus the bit. That's the flip and the invert together. Don't mutate the input, since the statement says to leave it unchanged.

How should I prepare in 48 hours for a matrix problem like this?+

Write the neighbor-sum loop from memory a couple of times, including the bounds check. Then trace Example 1 by hand, building the intermediate grid first. Test a 1x1 case and a single-row case, since those expose off-by-one errors fastest.

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

OA at Abridge?
Invisible during screen share
Get it