DEV Community


Posted on

Leetcode Solutions: Sum of Digits in the Minimum Number

Given an array A of positive integers, let S be the sum of the digits of the minimal element of A.
Return 0 if S is odd, otherwise return 1.

def get_min(arr):
    min_number = str(min(arr))
    total = 0

    for digit in min_number:
        total += int(digit)

    return 0 if total % 2 != 0 else 1

Enter fullscreen mode Exit fullscreen mode

Top comments (0)