The smallest permutation

Problem Name:
The smallest permutation
Site:HackerEarth
Links:
Tags:
Problem setters: