Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make Elements Divisible by Three

Minimum Operations to Make Elements Divisible by Three gives an integer array and asks for the fewest plus-one or minus-one operations needed to make every element divisible by three.

Statement

You are given an integer array nums. In one operation, you can add 11 to or subtract 11 from any element of nums.

Return the minimum number of operations needed to make all elements in nums divisible by 33.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 1≤1 \leq nums[i] ≤50\leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make Elements Divisible by Three

Minimum Operations to Make Elements Divisible by Three gives an integer array and asks for the fewest plus-one or minus-one operations needed to make every element divisible by three.

Statement

You are given an integer array nums. In one operation, you can add 11 to or subtract 11 from any element of nums.

Return the minimum number of operations needed to make all elements in nums divisible by 33.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 1≤1 \leq nums[i] ≤50\leq 50