Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Feature Description
You are given an integer array nums. In one operation, you can add or subtract 1 from any element of nums.
Return the minimum number of operations to make all elements of nums divisible by 3.
Use Case
Input: nums = [1,2,3,4]
Output: 3
Explanation:
All array elements can be made divisible by 3 using 3 operations:
Subtract 1 from 1.
Add 1 to 2.
Subtract 1 from 4.
Benefits
No response
Add ScreenShots
No response
Priority
High
Record
- I have read the Contributing Guidelines
- I'm a GSSOC'24 contributor
- I have starred the repository