leetcode problem

This commit is contained in:
jeevaramanthan.m 2023-10-09 10:32:08 +05:30
parent efec471784
commit c09ed1008f
2 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ def search_range(nums: list[int], target: int) -> list[int]:
[1, 1]
"""
def binary_search(nums, target, left):
def binary_search(nums:list, target:int, left:int):
low, high = 0, len(nums) - 1
index = -1
while low <= high:

View File

@ -8,7 +8,7 @@ Leetcode reference: https://leetcode.com/problems/lexicographical-numbers/
"""
def lexical_order(n: int) -> list[int]:
def lexical_order(num: int) -> list[int]:
"""
>>> lexical_order(13)
[1, 10, 11, 12, 13, 2, 3, 4, 5, 6, 7, 8, 9]
@ -21,7 +21,7 @@ def lexical_order(n: int) -> list[int]:
of characters according to their position in the alphabet.
"""
numbers = [str(i) for i in range(1, n + 1)]
numbers = [str(i) for i in range(1, num + 1)]
numbers.sort()
res = list(map(int, numbers))
return res