Lexicographic rank of a String

Given a string str, find its rank among all its permutations when sorted lexicographically. Note: The characters a string are all unique. Examples: Input: str … Continue reading Lexicographic rank of a String