JAVA_Sort Array By Parity II_LeetCode 922


JAVA_Sort Array By Parity II_LeetCode 922

JAVA_Sort Array By Parity II_LeetCode 922 풀이 class Solution { public int[] sortArrayByParityII(int[] nums) { int odd = 1, even = 0; int[] arr = new int[nums.length]; for(int a: nums){ if(a % 2 == 0){ arr[even] = a; even += 2; }else{ arr[odd] = a; odd+=2; } } return arr; } } * 출처 https://leetcode.com/problems/sort-array-by-parity-ii/ Sort Array By Parity II - LeetCode Can you solve this real interview question? Sort Array By Parity II - Given an array of integers nums, half of the integers in num...


#JAVA #JAVA_LeetCode922 #JAVA_SortArrayByParityII #JAVA_SortArrayByParityII_LeetCode922 #SortArrayByParityII_LeetCode922

원문링크 : JAVA_Sort Array By Parity II_LeetCode 922