Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make Array Sum Divisible by K

med
30 min
Try to solve the Minimum Operations to Make Array Sum Divisible by K problem.

Statement

You are given an integer array nums and an integer k.

In one operation, you can select any element in nums and decrease its value by 11.

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

Constraints:

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

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

  • 1≤1 \leq k ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Operations to Make Array Sum Divisible by K

med
30 min
Try to solve the Minimum Operations to Make Array Sum Divisible by K problem.

Statement

You are given an integer array nums and an integer k.

In one operation, you can select any element in nums and decrease its value by 11.

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

Constraints:

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

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

  • 1≤1 \leq k ≤100\leq 100