This is my code.
At first I have sorted the array by passing a function as the third parameter for comparing digits at each position. Then I printed the array in reverse order.
DESCRIPTION OF PARAMETER FUNCTION:
At first I converted the two integers a, b (the parameters in the comparator function) to strings A and B. String A is a and string B is b. Then at each index i checked if there is inequality. In case inequality found i return A[i] < B[i]. If there is equality I increment i till either end of A or B is reached. If end is reached i exit the loop, and then check, if size of A is same as size of B. If yes, i return A.size() == B.size(). Else , if A is bigger than B with respect to size, I check if last character of B is bigger than next character of A. Similar check is performed if B is bigger than A with respect to size.
I am unable to think of a test case where my logic will fail. But I am able to pass test case 0 only.
Please Help.