Given two positive integers M and K, find the maximum integer possible by doing at-most K swap operations on its digits.
Python Program code:
The idea is to use a simple selection sort algorithm to find the largest digit and swap it with the leftmost digit. We perform this operation at most K times, until we get the maximum number possible.