Given a number M (N-digit integer) and K-swap operations (a swap operation can swap 2 digits), what is an algorithm to get the maximum possible integer?

Examples:

- M = 132, K = 1, output = 312
- M = 132, K = 2, output = 321
- M = 7899, K = 2, output = 9987
- M = 8799, K = 2, output = 9987