I made a similar solution at the first time. An AC but slow pattern since we can finish it in one loop instead of K.

def removeKdigits(self, num, k):
def shrink(num):
for i in range(len(num) - 1):
if num[i] > num[i + 1]:
return num[:i] + num[i+1:]
return num[:-1]
for i in range(k):
num = shrink(num)
return str(int(num)) if num else "0"