Gary Lai
  • Home
  • About
Sign in Subscribe

386. Lexicographical Numbers

Last updated on  Mar 3, 2024

386. Lexicographical Numbers

class Solution:
    def lexicalOrder(self, n: int) -> List[int]:
        strArr = [str(i) for i in range(1,n+1)]
        strArr.sort()
        return [int(s) for s in strArr]
Previous 187. Repeated DNA Sequences
Next 380. Insert Delete GetRandom O(1)
Gary Lai © 2025
  • Sign up
Powered by Ghost