Algorithm · Rubrik · Hard
Problem An interstellar society is represented by a connected, undirected graph with n celestial bodies and m pathways. Each body corresponds to an alien entity, and every pathway (i, j) represents an alliance between entities i and j. Entity i has an energy level e_i. Entity j is considered eclipsed by entity i when e_j = e_i + 1; in other words, j has exactly one more unit of energy than i. The society has a stellar gradient when, for every alliance, one endpoint is…
Checking your access…