#3779
Minimum Number of Operations to Have Distinct Elements
specialist · 995 · lc medium +32 · 42.1% accepted · 44 likes · top 23%
Description
Given an integer array nums, repeatedly remove the first three elements in each operation (or all remaining elements if fewer than three are left) until the array is empty or contains no duplicate values, and return the total number of operations performed.
Code
1
2
3