Write a program to rotate elements of given array to left by K positions.
Input (int[], int) |
Output (int[]) |
{1, 2, 3, 4, 5, 6, 7, 8}, 2 |
{3, 4, 5, 6, 7, 8, 1, 2} |
{1, 2, 3, 4, 5, 6, 7, 8}, 5 |
{6, 7, 8, 1, 2, 3, 4, 5} |
{20, 6, 8, 11, 30}, 3 |
{11, 30, 20, 6, 8} |
{12, 15, 19, 1, 33}, 1 |
{15, 19, 1, 33, 12} |
{5, 6, 7, 8, 9, 10}, -2 |
{5, 6, 7, 8, 9, 10} |
{4, 6, 5, 7, 1}, 11 |
{6, 5, 7, 1, 4} |