Ad
Code
Diff
  • binary = lambda n: bin(n)[2:]
    • binary=lambda n:f'{n:b}'
    • binary = lambda n: bin(n)[2:]

Decomposition is the key to reuse and healthy code support.

Code
Diff
  • from typing import List
    
    def greatest(lst: List[int]) -> int:
        str_lst = [str(n) for n in lst]
        sorted_lst = sorted(str_lst, reverse=True)
        result = int(''.join(sorted_lst))
        
        return result
    
    • def greatest(lst):
    • return int(''.join(sorted([str(n) for n in lst], reverse=True)))
    • from typing import List
    • def greatest(lst: List[int]) -> int:
    • str_lst = [str(n) for n in lst]
    • sorted_lst = sorted(str_lst, reverse=True)
    • result = int(''.join(sorted_lst))
    • return result