LeetCode
Spiral Matrix III
Click
here
for an explanation.