Back to problems
COMP2521
24T2 Q10 — Max |in-deg − out-deg|
stdin: first line N M; then M lines u v (directed edges, vertices 0..N-1). Print the maximum over all vertices of |indegree − outdegree|.
Single-file C (gcc -O0 -Wall). Self-contained reframing of the exam's ADT-completion question. From COMP2521 24T2 Sample.
Samples
stdin
3 3 0 1 0 2 1 2
expected
2
c-gcc
14