/** * https://leetcode-cn.com/problems/sort-array-by-parity/submissions/ */ class Solution { public int[] sortArrayByParity(int[] A) { // 1. 边界处理,长度 <=1 什么都不做 if(A.length<=1){ return A; } // 2. 定义前后索引 int left = 0; int right = A.length-1; // 3. 移动元素 while(left