Your question is Minimize Batch Processing Time. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
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):