Skip to content

Latest commit

 

History

History
8 lines (8 loc) · 430 Bytes

note1217.md

File metadata and controls

8 lines (8 loc) · 430 Bytes
  • Type: Array, math
  • Approach:
    1. We can group the chips by checking whether its position index is odd or even, and count the number separately.
    2. Return the less number of groups, because we can have the same cost with the same parity.
  • Complexity:
    • Time: O(n)
    • Space: O(1)