力扣今日题-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
标签:even,1217,筹码,++,pos,力扣,int,odd 来源: https://www.cnblogs.com/liyublogs/p/16459842.html