力扣今日题-1217. 玩筹码
1217. 玩筹码
思路:
class Solution {
public int minCostToMoveChips(int[] pos) {
int odd = 0 ,even=0;
for(int i = 0; i < pos.length; i++){
if(pos[i] % 2 == 0){
even++;
}else{
odd++;
}
}
return Math.min(even,odd);
}
}
2022/7/8