package leetcode;

/**
 * https://leetcode.com/problems/play-with-chips/
 */
public class Problem1217 {
    public int minCostToMoveChips(int[] chips) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1217 prob = new Problem1217();
        System.out.println(prob.minCostToMoveChips(new int[]{1,2,3})); // 1
        System.out.println(prob.minCostToMoveChips(new int[]{2,2,2,3,3})); // 2
        System.out.println(prob.minCostToMoveChips(new int[]{1,1,2,3,3})); // 1
    }
}

package leetcode;

/**
 * https://leetcode.com/problems/play-with-chips/
 */
public class Problem1217 {
    public int minCostToMoveChips(int[] chips) {
        int even = 0;
        int odd = 0;
        for (int i = 0; i < chips.length; i++) {
            if (chips[i] % 2 == 0) {
                even++;
            } else {
                odd++;
            }
        }
        return Math.min(even, odd);
    }
}

Solve problem 1217