2025-04-08发表2025-04-12更新leetcode1 分钟读完 (大约146个字)0次访问leetcode-3396题目https://leetcode.cn/problems/minimum-number-of-operations-to-make-elements-in-array-distinct/description/?envType=daily-question&envId=2025-04-08 分析 很简单的一道遍历题 由题意可知,最后要的是一个所有元素都不相同的数组 操作方式为,每次删除前三个元素 故,原数组不可动 所以可以用哈希表记录数据数量 又因为数据规模很小,可以用数组替代 所以解法为 逐渐删除头部元素,每次删除后检查源代码https://github.com/Norton-Lin/algorithm/blob/master/go/src/leetcode_3396/2025_04_08_3396.go leetcode-3396https://norton-lin.github.io/2025/04/08/LeetCode/leetcode-3396/作者Norton-Lin发布于2025-04-08更新于2025-04-12许可协议leetcodehash数组