← Zomato questions
CodingReported in a candidate post, Sep 2025

Minimum swaps to sort a permutation of 1..n

Filed under Zomato

Given an array that is a permutation of 1..n, return the minimum number of swaps (of any two elements) needed to sort it in ascending order.

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 Zomato questions

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