Given two array rotate a 90 degrees clockwise NxN matrix.
for example
I = [
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 8, 9 ]
]
output should be
O = [
[ 3, 6, 9],
[ 2, 5, 8],
[ 1, 4, 7]
]
public class Matrix {
public static int[,] rotate(int[,] rotate) {
int[,] o = {{3,6,9},{2,5,8},{1,4,7}};
return o;
}
}
namespace Solution {
using NUnit.Framework;
using System;
// TODO: Replace examples and use TDD by writing your own tests
[TestFixture]
public class SolutionTest
{
[Test]
public void MyTest()
{
int[,] i = {{1,2,3},{4,5,6},{7,8,9}};
int[,] o = {{3,6,9},{2,5,8},{1,4,7}};
Assert.AreEqual(o, Matrix.rotate(i));
}
}
}