8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our do 8000 cumentation.
There was an error while loading. Please reload this page.
1 parent e45e928 commit b87ebf6Copy full SHA for b87ebf6
src/main/java/com/fishercoder/solutions/_189.java
@@ -77,4 +77,18 @@ public static void rotate_naive(int[] nums, int k) {
77
}
78
79
80
+
81
+ public static class Solution3 {
82
+ public void rotate(int[] nums, int k) {
83
+ int tmp = 0;
84
+ for (int i = 0; i < k; i++) {
85
+ tmp = nums[nums.length - 1];
86
+ for (int j = nums.length - 1; j > 0; j--) {
87
+ nums[j] = nums[j-1];
88
+ }
89
+ nums[0] = tmp;
90
91
92
93
94
0 commit comments