Kac Ring Dynamic System Simulation
Asked at Voleon · Coding Questions · Difficulty: Hard · Last asked Jul 15, 2026
Implement a Kac ring model with N points, each occupied by a white or black ball, and M of these points are marked. Each step, balls move one position clockwise, and if a ball leaves a marked point, it changes color. Provide two functionalities: 1) `step()` method to advance the model by one step and return the ratio (W - B) / N, where W is the number of white balls and B is the number of black balls, with a complexity of O(1); 2) `kstep(k)` method to advance the model by k steps, with a complexity of O(1).
Loading the problem…