DEV Community

SalahElhossiny
SalahElhossiny

Posted on

1 1

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay