• + 1 comment

    Python3, tried this way

    from functools import cmp_to_key
    
    def compare_big(num1, num2):
        if len(num1) > len(num2):
            return 1
        elif len(num1) < len(num2):
            return -1
        else:
            for d1, d2 in zip(num1, num2):
                if d1 > d2:
                    return 1
                elif d1 < d2:
                    return -1
            return 0
    
    def bigSorting(unsorted):
        return sorted(unsorted, key=cmp_to_key(compare_big))
        # Write your code herefrom functools import cmp_to_key
    
    def compare_big(num1, num2):
        if len(num1) > len(num2):
            return 1
        elif len(num1) < len(num2):
            return -1
        else:
            for d1, d2 in zip(num1, num2):
                if d1 > d2:
                    return 1
                elif d1 < d2:
                    return -1
            return 0
    
    def bigSorting(unsorted):
        return sorted(unsorted, key=cmp_to_key(compare_big))
        # Write your code here
    

    B