Most repeated label on a path
A directed graph has n = len(labels) nodes numbered 0 to n - 1. Node i carries the lowercase letter labels[i], and each pair [a, b] in edges is an edge from a to b. A path is any sequence of nodes where each step follows an edge; a single node counts. Its score is how many times its most frequent letter appears on it. Return the highest score of any path, or -1 if the graph has a cycle anywhere (a path could then loop forever).
labels is not empty; edges may repeat, and a self-loop is a cycle.
Besides the tests, one large input (40 nodes, over 4 million paths) with a ~100 ms limit (scaled to your device's speed): brute force won't pass.
Examples
most_repeated_label("abaca", [[0,1],[0,2],[2,3],[3,4]])→3most_repeated_label("ab", [[0,1],[1,0]])→-1most_repeated_label("xyz", [])→1