Graph Theory37 sections · 1633 units
Open in Course

Problem - Mail Delivery

CSES 1691 - Find Euler circuit.

Problem: A mailman wants to deliver mail along every street in a city exactly once and return to the post office. The city has nn intersections and mm streets. Find a valid route.

Link: CSES 1691

Constraints:

  • 2n1052 \leq n \leq 10^5
  • 1m2×1051 \leq m \leq 2 \times 10^5
  • Streets are undirected

Output: A sequence of intersections forming an Euler circuit, or "IMPOSSIBLE" if none exists.