コード例 #1
0
        public void Test01()
        {
            var grid = new[, ]
            {
                { 1, 2, 3 },
                { 4, 5, 6 },
                { 7, 8, 9 }
            };
            var instance = new SpiralMatrix();
            var res      = instance.PrintSpiral(grid);

            // Assert.AreEqual(new []{ 1, 2, 3, 6, 9, 8, 7, 4, 5 }, res);

            grid = new[, ]
            {
                { 1, 2, 3 },
                { 4, 5, 6 }
            };
            res = instance.PrintSpiral(grid);
            Assert.AreEqual(new[] { 1, 2, 3, 6, 5, 4 }, res);
        }