C - solution using stack Runtime: 0 ms, faster than 100.00% of C online submissions
\n#define STACK_SZ 100000\n\nchar * removeKdigits(char * num, int k)\n{\n    int n = strlen(num);\n    char stack[STACK_SZ];\n    int head = -1;  /* pointer to 
```\n#define STACK_SZ 100000\n\nchar * removeKdigits(char * num, int k)\n{\n    int n = strlen(num);\n    char stack[STACK_SZ];\n    int head = -1;  /* pointer to the head of the stack */\n    \n    for (int i = 0; i < n; i++) {\n        while (head != -1 && k && stack[head] > num[i]) {\n            --head;\n            --k;\n        }\n        /* To avoid any trailing zeroes */\n        if (head != -1 || num[i] != \'0\')\n            stack[++head] = num[i];\n    }\n    \n\t/* If the digits of a given number are in ascending order */\n    while (k-- && head != -1)\n        --head;\n\t\n    /* If stack is empty */\n    if (head == -1)\n        return "0";\n\t\n    /* Popping out the remaining digits from the stack */\n    while (head != -1)\n        num[--n] = stack[head--];\n    \n    return num + n;\n}\n```
['C']