Remove K-digits

Challenge Given a non-negative number represented as a string, return the smaller possible integer after removing K digits. E.g "1041" 1 Will output 41 Solution 1 I really liked my first solution, however performances can’t be worst. It’s a brute force approach doing backtracking, basically I tried to remove 3 digits in every possible position. from copy import deepcopy class Solution: def helper(self, num, k, arr, start): if len(arr) == k: self....

May 3, 2021 · 2 min · Nolan