JAVA_Sort Array By Parity_LeetCode 905


JAVA_Sort Array By Parity_LeetCode 905

JAVA_Sort Array By Parity_LeetCode 905 풀이 class Solution { public int[] sortArrayByParity(int[] nums) { int i = 0; for (int j = 0; j < nums.length; j++){ if (nums[j] % 2 == 0) { int temp = nums[i]; nums[i++] = nums[j]; nums[j] = temp;; } } return nums; } } * 출처 Sort Array By Parity - LeetCode Can you solve this real interview question? Sort Array By Parity - Given an integer array nums, move all the even integers at the beginning of the array followed by all the odd integers. Return any array th...


#JAVA #JAVA_LeetCode905 #JAVA_SortArrayByParity #JAVA_SortArrayByParity_LeetCode905 #SortArrayByParity_LeetCode905

원문링크 : JAVA_Sort Array By Parity_LeetCode 905