2374. Node With Highest Edge Score
On This Page
class Solution:
def edgeScore(self, edges: List[int]) -> int:
cnt = Counter()
for i, v in enumerate(edges):
cnt[v] += i
res = 0
for i in range(len(edges)):
if cnt[res] < cnt[i]:
res = i
return res