Search
⌘K
Get Premium
Leetcode 2344. Minimum Deletions to Make Array Divisible
Delete as few elements from nums as needed so that the smallest remaining element divides every number in numsDivide, returning -1 if impossible. Key observation: let g = gcd(all elements of numsDivide); you need the smallest element in nums that is a divisor of g (if none exists it's impossible).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.