Leetcode 2870. Minimum Number of Operations to Make Array Empty
Given an array where you can repeatedly remove either two or three equal elements, compute the minimum number of such operations to delete all elements (or return -1 if impossible). This reduces to counting frequencies of each value and, for each frequency, finding the minimum number of 2- and 3-sized batches (impossible if any frequency is 1).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.