There was an error while loading. Please reload this page.
1 parent 6823849 commit d941534Copy full SHA for d941534
Java/905.java
@@ -0,0 +1,11 @@
1
+class Solution {
2
+ public int[] sortArrayByParity(int[] nums) {
3
+ for (int i=0, j=0; j<nums.length; j++)
4
+ if (nums[j] % 2 == 0) {
5
+ int temp = nums[i];
6
+ nums[i++] = nums[j];
7
+ nums[j] = temp;
8
+ }
9
+ return nums;
10
11
+}
0 commit comments