Coding

Find the node with the highest edge score in a directed graph.

You are given a directed graph. Calculate the edge score of each node, which is the sum of the labels of all nodes that have an edge pointing to it. Return the node with the highest edge score.

Input: edges = [1,0,1,1,1]

Output: 1

Explanation: Node 1 receives incoming edges from 0, 2, 3, and 4. Its score is 0 + 2 + 3 + 4 = 9, which is the highest.

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

No answers yet

Be the first to share your approach to this question

Practice More Questions