Create Lexicographically Largest Permutation

Problem Overview

  • Traverse all nodes of an undirected connected graph at least once to record order A, then return B, the lexicographically largest permutation of A.
  • Input: edges via g_from[] and g_to[] describing M connections among g_nodes; Output: int[] B.
  • Domain: graph traversal and ordering, relevant to network routing, paths, and scheduling.
  • Source: Oracle interviews; a coding interview problem and interview question testing arrays and graphs.

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: