2023-11-21发表2023-11-21更新LeetCode每日一题几秒读完 (大约81个字)0次访问2216. 美化数组的最少删除数2216. 美化数组的最少删除数 难度: medium 原始链接: https://leetcode.cn/problems/minimum-deletions-to-make-array-beautiful 标签: 模拟 解法一: 模拟go1234567891011121314func minDeletion(nums []int) int { count := 1 pre := nums[0] for _, num := range nums[1:] { if pre != num || pre == num && (count & 1) == 0 { count++ pre = num } } if (count & 1) != 0 { return len(nums) - count + 1 } return len(nums) - count} 2216. 美化数组的最少删除数https://wuhunyu.top/leetcode/2023/11/minimum-deletions-to-make-array-beautiful/index.html作者wuhunyu发布于2023-11-21更新于2023-11-21许可协议#模拟