Skip to content
We areTOP 1%

News Distribution

MediumRating 1400CodeforcesUnion-Find (DSU)
Solve on Codeforces(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Approach hintTry it first, then reveal

Union every member of a group with that group's first member while tracking component sizes. Each user's answer is simply the size of the component that contains them.

More in Union-Find (DSU)

Union-Find (DSU) questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Redundant ConnectionLeetCodeMedium Solve Redundant Connection on LeetCode (opens in a new tab)
2Satisfiability of Equality EquationsLeetCodeMedium Solve Satisfiability of Equality Equations on LeetCode (opens in a new tab)
3Number of Operations to Make Network ConnectedLeetCodeMedium Solve Number of Operations to Make Network Connected on LeetCode (opens in a new tab)
4News DistributionCodeforcesMedium 1400Solve News Distribution on Codeforces (opens in a new tab)
5Accounts MergeLeetCodeMedium Solve Accounts Merge on LeetCode (opens in a new tab)
6Most Stones Removed with Same Row or ColumnLeetCodeMedium Solve Most Stones Removed with Same Row or Column on LeetCode (opens in a new tab)
7Bear and Friendship ConditionCodeforcesMedium 1500Solve Bear and Friendship Condition on Codeforces (opens in a new tab)
8SocksCodeforcesMedium 1600Solve Socks on Codeforces (opens in a new tab)
9Destroying ArrayCodeforcesMedium 1600Solve Destroying Array on Codeforces (opens in a new tab)
10Path QueriesCodeforcesHard 1800Solve Path Queries on Codeforces (opens in a new tab)
11Making A Large IslandLeetCodeHard Solve Making A Large Island on LeetCode (opens in a new tab)
12Remove Max Number of Edges to Keep Graph Fully TraversableLeetCodeHard Solve Remove Max Number of Edges to Keep Graph Fully Traversable on LeetCode (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account