2216. Minimum Deletions to Make Array Beautiful
Содержание
class Solution:
def minDeletion(self, nums: List[int]) -> int:
n = len(nums)
res = i = 0
while i < n:
j = i + 1
while j < n and nums[j] == nums[i]:
j += 1
res += 1
i = j + 1
res += (n - res) % 2
return res