Tap here to switch tabs
Problem
Submissions

Problem: Largest Component Size by Common Factor

med
30 min
Try to solve the Largest Component Size by Common Factor problem.

Statement

You are given an array of unique positive integers nums.

Consider an undirected graph where:
• There are nums.length nodes labeled nums[0] through nums[nums.length - 1].
• An edge connects nums[i] and nums[j] if nums[i] and nums[j] share a common factor strictly greater than 11.

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

Constraints:

  • 1≤nums.length≤2×1041 \leq \text{nums.length} \leq 2 \times 10^4

  • 1≤nums[i]≤1051 \leq \text{nums[i]} \leq 10^5

  • All the values of nums are unique.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Largest Component Size by Common Factor

med
30 min
Try to solve the Largest Component Size by Common Factor problem.

Statement

You are given an array of unique positive integers nums.

Consider an undirected graph where:
• There are nums.length nodes labeled nums[0] through nums[nums.length - 1].
• An edge connects nums[i] and nums[j] if nums[i] and nums[j] share a common factor strictly greater than 11.

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

Constraints:

  • 1≤nums.length≤2×1041 \leq \text{nums.length} \leq 2 \times 10^4

  • 1≤nums[i]≤1051 \leq \text{nums[i]} \leq 10^5

  • All the values of nums are unique.