main idea: there is no cost to move even steps, so to weigh coins number in odd and even position. Whichever has the less ammount will move to the opposite position.
# time O(N) space O(1)
class Solution:
def minCostToMoveChips(self, position: List[int]) -> int:
odd = 0
even = 0
for pos in position:
if pos%2 == 0:
even += 1
else:
odd += 1
return min(odd,even)