Tap here to switch tabs
Problem
Submissions

Problem: Properties Graph

med
30 min
Try to solve the Properties Graph problem.

Statement

You are given a 22D integer array properties of size nimesmn imes m, and an integer k.

An undirected graph with nn vertices is constructed where each vertex ii (0≤i<n0 \le i < n) corresponds to the array properties[i]. An edge exists between vertex ii and vertex jj (i≠ji \neq j) if the number of distinct values shared by both properties[i] and properties[j] is at least k.

Return the number of connected components in the graph.

Constraints:

  • 1≤n==1 \le n == properties.length ≤100\le 100

  • 1≤m==1 \le m == properties[i].length ≤100\le 100

  • 1≤1 \le properties[i][j] ≤100\le 100

  • 1≤k≤m1 \le k \le m

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Properties Graph

med
30 min
Try to solve the Properties Graph problem.

Statement

You are given a 22D integer array properties of size nimesmn imes m, and an integer k.

An undirected graph with nn vertices is constructed where each vertex ii (0≤i<n0 \le i < n) corresponds to the array properties[i]. An edge exists between vertex ii and vertex jj (i≠ji \neq j) if the number of distinct values shared by both properties[i] and properties[j] is at least k.

Return the number of connected components in the graph.

Constraints:

  • 1≤n==1 \le n == properties.length ≤100\le 100

  • 1≤m==1 \le m == properties[i].length ≤100\le 100

  • 1≤1 \le properties[i][j] ≤100\le 100

  • 1≤k≤m1 \le k \le m