Practice Minimum Division Operations to Make Array Non Decreasing
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Minimum Division Operations to Make Array Non Decreasing
Problem Statement
You are given an integer array nums. Any positive divisor of a natural number x that is strictly less than x is called a proper divisor of x. For example, 2 is a proper divisor of 4, while 6 is not a proper divisor of 6. You are allowed to perform an operation any number of times on nums, where in each operation you select any one element from nums and divide it by its greatest proper divisor. Return the minimum number of operations required to make the array non-decreasing. If it is not possible to make the array non-decreasing using any number of operations, return -1.
Source: Minimum Division Operations to Make Array Non Decreasing on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [25,7]
1
# Example 2
nums = [7,7,6]
-1
# Example 3
nums = [1,1,1,1]
0
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Division Operations to Make Array Non Decreasing.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.