How can I modify this answer class using generics? Here I am shifting each element right by one index and the last element is moved to the first index.
internal class Answer
{
public static int[] Rollover(int[] B, int K)
{
for (int j = 0; j < K; j++)
{
int lastelement = B[B.Length - 1];
for (int i = B.Length - 1; i > 0; i--)
{
B[i] = B[i - 1];
}
B[0] = lastelement;
}
return B;
}
}