DeepRest

Minimum Cost to Move Chips to The Same Position

Dec 6th, 2021 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.19 KB | None | 0 0
  1. class Solution:
  2.     def minCostToMoveChips(self, position: List[int]) -> int:
  3.         odd = 0
  4.         for i in position:
  5.             odd += i % 2
  6.         return min(odd, len(position) - odd)
Add Comment
Please, Sign In to add comment