#3495
Minimum Operations to Make Array Elements Zero
expert · 1185 · lc hard +32 · 60.4% accepted · 385 likes · top 59%
Description
Each query [l, r] describes an array containing all integers from l to r. In one operation, pick two elements a and b and replace both with floor(a/4) and floor(b/4) respectively.
For each query, compute the minimum operations to bring all elements to zero. Return the total across all queries.
Code
1
2
3