Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
If <code>x % 3 != 0</code> we can always increment or decrement <code>x</code> such that we only need 1 operation.
Add <code>min(nums[i] % 3, 3 - (num[i] % 3))</code> to the count of operations.