Problem 3391 · Medium

Design a 3D Binary Matrix with Efficient Layer Tracking

Build a class over an n by n by n grid of bits, all 0 at first, that can set or clear any cell and report which first-coordinate layer holds the most 1s, with the largest layer index winning a tie.

Open the interactive visualisation