1217. Minimum Cost to Move Chips to The Same Position

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 1217

class Solution:
    def minCostToMoveChips(self, position: List[int]) -> int:
        a = sum(p % 2 for p in position)
        b = len(position) - a
        return min(a, b)