Clear
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var arr = new int[] { 1, 2, 3, 4, 5, 6};
|
||||
var arr = new int[] { 1, 2, 3, 4, 5, 6 };
|
||||
new Solution().Rotate(arr, 3);
|
||||
Console.WriteLine(String.Join(" ", arr));
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ public class Solution
|
||||
k %= nums.Length;
|
||||
if (k == 0)
|
||||
return;
|
||||
int oneCycleLen = nums.Length/ GCD(nums.Length, k);
|
||||
int oneCycleLen = nums.Length / GCD(nums.Length, k);
|
||||
for (int i = 0; i < nums.Length / oneCycleLen; i++)
|
||||
MoveTo(nums, nums[i], i + k, k, oneCycleLen);
|
||||
}
|
||||
@@ -30,5 +30,5 @@ public class Solution
|
||||
return b == 0 ? a : GCD(b, a % b);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user