leetle

Daily challenge for 2026-11-14

683. Largest FizzBuzz Graph Component

Given an undirected graph with n nodes labeled from 1 through n and a list edges, first remove every node whose label is not divisible by 3 or 5, along with every edge incident to a removed node.

Return the largest number of nodes in any connected component of the remaining graph. An eligible node with no remaining neighbors forms a component of size 1. If no eligible node exists, return 0.

Constraints: 1 <= n <= 1000, with at most 5000 edges. Each edge has two valid node labels. Self-loops and repeated edges are allowed.

Example:
Input: n = 10, edges = [[3, 5], [5, 6], [6, 9], [9, 10], [1, 2], [2, 4]]
Output: 5

Run this challenge interactively in Python or JavaScript when the app loads.