Practice Minimum Deletions to Make Array Divisible
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Minimum Deletions to Make Array Divisible
Problem Statement
You are given two positive integer arrays nums and numsDivide. You can delete any number of elements from nums. Return the minimum number of deletions such that the smallest element in nums divides all the elements of numsDivide. If this is not possible, return -1. Note that an integer x divides y if y % x == 0.
Source: Minimum Deletions to Make Array Divisible on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [2,3,2,4,3], numsDivide = [9,6,9,3,15]
2
# Example 2
nums = [4,3,6], numsDivide = [8,2,6,10]
-1
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Deletions to Make Array Divisible.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.