LeetCode Solutions/December 2021 LeetCoding Challenge/Minimum Cost to Move Chips to The Same Position.java
<reponame>DevashishPathrabe/LeetCodeclass Solution {
    public int minCostToMoveChips(int[] position) {
        int oddNumbers = 0;
        int evenNumbers = 0;
        for(int i : position){
            if(i%2 == 0){
                evenNumbers += 1;
            } else{
                oddNumbers += 1;
            }
        }
        if(evenNumbers > oddNumbers){
            return oddNumbers;
        }
        return evenNumbers;
    }
}