This content originally appeared on DEV Community and was authored by SalahElhossiny
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 getMin(arr):
s = str(min(arr))
total = 0
for c in s:
total += int(c)
return 0 if total % 2 != 0 else 1
print(getMin([99,77,33,66,55]))
This content originally appeared on DEV Community and was authored by SalahElhossiny
SalahElhossiny | Sciencx (2022-07-10T10:16:19+00:00) Leetcode Solutions: Sum of Digits in the Minimum Number. Retrieved from https://www.scien.cx/2022/07/10/leetcode-solutions-sum-of-digits-in-the-minimum-number/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.