← Questions

Flip, invert and smooth a binary image

0
AbridgeCodingLast asked Sep 2026

You get a binary matrix. Mirror each row left to right and flip every bit, then smooth the result: each cell becomes the floor of the average of itself and its neighbors in the surrounding 3 x 3 block, counting only cells inside the matrix. Every average must use the fully transformed matrix, not cells you've already overwritten. Return the new matrix and leave the input untouched.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding