Light Cells Activation
Build a 3×3 grid of light cells (omitting the center cell) where you can click on the cells to activate them, turning them green.
When all the cells have been activated, they will be deactivated one by one in the reverse order they were activated with a 300ms interval in between.
这道题要求实现一个 3×3 的灯格交互面板,中间格子被省略,用户点击任意可用格子后将其点亮为绿色;当所有格子都被点亮后,需要按照“后点亮先熄灭”的顺序依次恢复,且每次状态切换间隔为 300ms。核心在于维护一个点击 / 激活顺序栈或数组,记录每个格子的激活顺序,再在触发回放时逆序遍历并配合定时器逐个关闭,考察的是前端状态管理、事件处理以及定时控制。