Skip to content

1217-minimum-cost-to-move-chips-to-the-same-position

DevGod
DevGod
Elf Vtuber
/**
* @param {number[]} position
* @return {number}
*/
var minCostToMoveChips = function(position) {
let odd = 0;
let even = 0;
for(let coin of position){
if(coin%2){odd++}else{even++;}
}
return Math.min(odd,even);
};