Tap here to switch tabs
Problem
Submissions

Problem: Minimize Array Sum Using Divisible Replacements

Try to solve the Minimize Array Sum Using Divisible Replacements problem.

Statement

You are given an integer array nums.

In one operation, you can choose two indices a and b such that nums[a] % nums[b] == 00, and replace nums[a] with the value of nums[b].

You may apply this operation any number of times.

Return the minimum possible sum of the elements in nums after any number of operations.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimize Array Sum Using Divisible Replacements

Try to solve the Minimize Array Sum Using Divisible Replacements problem.

Statement

You are given an integer array nums.

In one operation, you can choose two indices a and b such that nums[a] % nums[b] == 00, and replace nums[a] with the value of nums[b].

You may apply this operation any number of times.

Return the minimum possible sum of the elements in nums after any number of operations.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5