#3190

Find Minimum Operations to Make All Elements Divisible by Three

easy · 90.9% accepted · 511 likes · top 100%

array · math

⊣ practice⊣ open on leetcode ↗

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.

Solution