Available question text
Assign each node an integer group 1..m so every edge joins nodes whose group indices differ by exactly 1; return the maximum possible m or -1 if no such labeling exists. Core challenge: detect impossibility (odd cycles) and compute the maximum feasible layering (longest valid BFS-like level assignment) across the graph/components.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2493. Divide Nodes Into the Maximum Number of Groups
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source