386. Lexicographical Numbers
You must write an algorithm that runs in O(n) time and uses O(1) extra space.
class Solution:
def lexicalOrder(self, n: int) -> List[int]:
res = []
for i in range(1, n + 1):
bisect.insort(res, str(i))
return ...
tapanrachchh.hashnode.dev1 min read