← Flipkart questions
CodingHard

Lexicographically maximum array with index swaps

Filed under Flipkart

Given an array and a set of index pairs (n = 1e5, pairs = 1e5), print the lexicographically maximum array possible by performing any number of swaps between allowed index pairs.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Flipkart questions

Collected from public candidate posts and coding forums. Updated Nov 2026.