
nums 순회k번 내에서 앞쪽에 큰 수들을 최대한 제거0을 모두 제거한 결과가 유효하다면 반환, 그렇지 못하다면 0 반환function removeKdigits(num: string, k: number): string {
const stack = []
for(const digit of num) {
while(stack.length > 0 && stack[stack.length - 1] > digit && k > 0) {
stack.pop()
k--
}
stack.push(digit)
}
while(stack.length > 0 && k > 0) {
stack.pop()
k--
}
return stack.join('').replace(/^0+/, '') || '0'
};