sakshamsaxena06984 / permutation-swaps Goto Github PK
View Code? Open in Web Editor NEWKevin has a permutation P of N integers 1, 2, ..., N, but he doesn't like it. Kevin wants to get a permutation Q. Also he believes that there are M good pairs of integers (ai , bi). Kevin can perform following operation with his permutation: Swap Px and Py only if (x, y) is a good pair. Help him and tell if Kevin can obtain permutation Q using such operations.