hardArrayHash TableMathNumber TheoryUnion Find 0 views

Largest Component Size by Common Factor

You are given an integer array of unique positive integers nums.

You are given an integer array of unique positive integers nums. Consider the following graph:

Return the size of the largest connected component in the graph.

Largest Component Size by Common Factor diagram

Example 1

Input: nums = [4,6,15,35]

Output: 4

Example 2

Input: nums = [20,50,9,63]

Output: 2

Example 3

Input: nums = [2,3,6,7,4,12,21,39]

Output: 8

Constraints

  • 1 <= nums.length <= 2 * 10^4
  • 1 <= nums[i] <= 10^5
  • All the values of nums are unique.

Hints

No hints yet.

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.