[LeetCode]Add Digits

    xiaoxiao2021-12-15  19

    https://leetcode.com/problems/add-digits/

    找规律

    ~input: 0 1 2 3 4 ... output: 0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 1 2 3 ....

    public class Solution { public int addDigits(int num) { return 1 + (num - 1) % 9; } }

    转载请注明原文地址: https://ju.6miu.com/read-999983.html

    最新回复(0)