https://leetcode.com/problems/add-digits/Given a non-negative integer num, repeatedly add all its digits until the rke: 3 + 8 = 11,
原创
2022-12-02 00:52:30
105阅读
Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 =
原创
2023-02-17 09:39:17
40阅读
https://leetcode.com/problems/add-digits/Given a non-negative integer num, repeatedly
原创
2022-12-13 16:01:11
63阅读
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like:
转载
2017-05-19 17:36:00
261阅读
2评论
题目链接:https://leetcode.com/problems/add-digits/题目:Given a non-negative integer num, repeatedly add all its digits until the res
原创
2023-07-27 00:01:15
44阅读
原题链接在这里:https://leetcode.com/problems/add-digits/ 题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one di
转载
2015-08-17 01:13:00
399阅读
2评论
Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the proce
转载
2017-07-05 16:33:00
202阅读
2评论
一看不让用循环就有点蒙。
只能找规律。和9相关。
class Solution {
public:
int addDigits(int num) {
if(num==0) return 0;
if(num%9==0) return 9;
return num%9;
}
}
};
原创
2022-08-05 15:58:46
47阅读
https://leetcode.com/problems/add-digits/understanding:所有可能的值是1-9, 可以考虑是10或者9的余数,再加1或者减1公式就是(num - 1) %9 + 1
原创
2023-06-29 09:43:33
49阅读
1、题目Given a non-negative integernum, repeatedly add all its digi
原创
2021-08-12 15:43:51
85阅读
/* Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one
原创
2021-07-09 14:06:14
35阅读
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Follow up:Could you do it without any lo
转载
2019-10-28 09:19:00
68阅读
2评论
Given a non negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Explanation: The pro
转载
2018-10-05 11:11:00
120阅读
2评论
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For exam
原创
2022-08-03 16:56:37
41阅读
题目:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2
原创
2023-03-07 12:33:50
21阅读
1、题目Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + 8 = 11,1 + 1 = 2. Since
原创
2022-03-11 10:10:40
61阅读
/* Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one
原创
2022-02-03 14:04:32
55阅读
LeetCode Java Add Digits
原创
2022-08-25 12:36:01
34阅读
Given a non-negative integer num, repeatedly add all its digits until the result has only
one digit.
+ 8 = 11, 1 + 1 = 2. Since 2 has
on
原创
2023-09-05 09:28:23
12阅读
题目
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
Example:
Input: 38
Output: 2
Explanation: The process is like: 3 + 8 = 11, 1 + 1 = 2.
原创
2024-06-17 09:10:18
31阅读