Skip to content

Commit 9aaf634

Browse files
authored
Create 1085-sum-of-digits-in-the-minimum-number.js
1 parent 53415dc commit 9aaf634

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {number}
4+
*/
5+
const sumOfDigits = function(nums) {
6+
let min = Math.min(...nums);
7+
let ans = 0;
8+
while (min > 0) {
9+
ans += min % 10;
10+
min = ~~(min / 10);
11+
}
12+
return 1 - ans % 2;
13+
};

0 commit comments

Comments
 (0)