Check Path Presence

Problem Overview

  • Determine if an undirected graph has a direct path 1→2→…→N, visiting all vertices in increasing order.
  • Input: N vertices and M edges via arrays A and B; Output: return 1 if such an ordered path exists, else 0.
  • Domain: graph theory validation of ordered connectivity, relevant to network routing or workflow sequences.
  • This Microsoft interviews problem is a classic coding interview and interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: