Skip to main content
3 events
when toggle format what by license comment
Apr 18, 2022 at 6:57 comment added Toby Speight @Abdul, your example has one cycle with length 2 - that's [3,1]. A length-2 cycle needs just one swap to resolve, giving the expected result.
Apr 17, 2022 at 15:16 comment added Abdul Rehman Out of curiosity, let's say I have an array of [3,2,1]. if I only mark the location I will get 2 as a result. However, If I swap, it will be done in one. @Toby correct me if I am wrong.
Feb 3, 2021 at 17:31 history answered Toby Speight CC BY-SA 4.0