InterviewBit Problems   Sorted Permutation Rank : Solved