Permutation Index II(LintCode 198):

Problem