Permutation Transformation Problem

Company: Myntra

Difficulty: medium