Given an integer N, permute its digits in such a way such that the absolute difference between the resulting number and N is maximum and the difference is divisible by 9.
123 can be permuted to 321 to the get the maximum number divisible by 9 ie. 321 - 123 = 198.