rewrite leetcode spiral matrix