368. The Busiest Vertex
The degree of a vertex is the number of edges touching it. Print the vertex with the highest degree. If several vertices tie, print the smallest of their numbers.
No traversal is needed. Degree is a property of the edge list, so a counter array filled while reading the input is the whole solution.
Read the tie rule carefully, because it is what most of the tests are about. In a cycle every vertex has the same degree, and in a graph with no edges every vertex has degree 0; both cases answer 1.
Constraints - `1 ≤ n ≤ 100000` - `0 ≤ m ≤ 200000` - There are no self-loops and no repeated edges.
Input
The first line contains two integers n and m, the number of vertices and
edges. Each of the next m lines contains two integers u and v, an
undirected edge between those vertices. Vertices are numbered 1 to n.
Output
Print one integer, the vertex number.
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.