# 1217. Minimum Cost to Move Chips to The Same Position

• Time:
• Space:
  1 2 3 4 5 6 7 8 9 10 11 class Solution { public: int minCostToMoveChips(vector& chips) { vector count(2); for (int chip : chips) ++count[chip % 2]; return min(count[0], count[1]); } }; 
  1 2 3 4 5 6 7 8 9 10 class Solution { public int minCostToMoveChips(int[] chips) { int[] count = new int[2]; for (int chip : chips) ++count[chip % 2]; return Math.min(count[0], count[1]); } } 
 1 2 3 4 5 6 7 8 class Solution: def minCostToMoveChips(self, chips: List[int]) -> int: count = [0] * 2 for chip in chips: count[chip % 2] += 1 return min(count[0], count[1])