We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 22814eb + 156c921 commit 4023034Copy full SHA for 4023034
csharp/0283-move-zeroes.cs
@@ -21,4 +21,20 @@ public void MoveZeroes(int[] nums)
21
readIndex++;
22
}
23
24
-}
+}
25
+
26
+public class NeetCodeWaySolution { //NeetCodeWay
27
+ public void MoveZeroes(int[] nums) {
28
+ if (nums.Length <= 1) return;
29
+ int l = 0, r = 0;
30
+ while (r < nums.Length) {
31
+ if (nums[r] != 0) {
32
+ var t = nums[l];
33
+ nums[l++] = nums[r];
34
+ nums[r++] = t;
35
+ } else {
36
+ ++r;
37
+ }
38
39
40
0 commit comments