Skip to content

Practice Find the Maximum Divisibility Score

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2644
LeetCode Problem

Find the Maximum Divisibility Score

Problem Statement

You are given two integer arrays nums and divisors. The divisibility score of divisors[i] is the number of indices j such that nums[j] is divisible by divisors[i]. Return the integer divisors[i] with the maximum divisibility score. If multiple integers have the maximum score, return the smallest one.

Source: Find the Maximum Divisibility Score on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [2,9,15,50], divisors = [5,3,7,2]
Output
2

# Example 2

Input
nums = [4,7,9,3,9], divisors = [5,2,3]
Output
3

# Example 3

Input
nums = [20,14,21,10], divisors = [10,16,20]
Output
10

Constraints

1 <= nums.length, divisors.length <= 1000
1 <= nums[i], divisors[i] <= 10^9

Related LeetCode Problems

Practice more problems similar to Find the Maximum Divisibility Score.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.