题目描述
Given a string str containing only lower case alphabets, the task is to sort it in lexicographically-descending order.
Example 1:
Input: str = "geeks"
Output: "skgee"
Explanation: It's the lexicographically-
descending order.
ââ¬â¹Example 2:
Input: str = "for"
Output: "rof"
Explanation: "rof" is in
lexicographically-descending order.
Your Task:
You don't need to read input or print anything. Your task is to complete the function ReverseSort() which takes the string str as inputs and returns the modified string.
Expected Time Complexity: O(|str|)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ |str| ≤ 10^{5}
输入格式
见题面
输出格式
见题面
样例输入
str = "geeks"
样例输出
"skgee"