At Stripe, an engineering team tracks repeated workload sizes in a batch job and wants to reduce processing overhead. Given an integer array tasks, return the minimum number of operations needed to remove all tasks, where one operation can remove either 2 equal values or 3 equal values.
If it is impossible to remove all tasks under these rules, return -1.
tasks — a list of integers-1 if no valid sequence existsdef min_operations(tasks):