#刷题交流# 螺旋陈列问题
初始化一个 width x width 的二维数组 matrix,所有元素为0。
定义四个边界:top = 0, bottom = width - 1, left = 0, right = width - 1。
使用一个循环来填充螺旋:
从左到右填充上边界。
从上到下填充右边界。
从右到左填充下边界。
从下到上填充左边界。
每次填充完一层后,更新边界:top += 1, bottom -= 1, left += 1, right -= 1。
当 top > bottom 或 left > right 时,停止填充。