Time to a Stable Permutation

Company: Mathworks

Difficulty: medium