leetcode1217

 1 class Solution:
 2     def minCostToMoveChips(self, chips: List[int]) -> int:
 3         n = len(chips)
 4         odd,even = 0,0
 5         for i in range(n):
 6             cur = chips[i]
 7             if cur % 2 == 0:
 8                 even += 1
 9             else:
10                 odd += 1
11         return min(even,odd)

 

上一篇:CF1272E. Nearest Opposite Parity 题解 广度优先搜索


下一篇:n = 5x+2y+z